Hey Marco,   Thanks for the hint about renice and nice, that’s …

Comment on How to delete million of files on busy Linux servers (Work out Argument list too long) by admin.

Hey Marco,

 

Thanks for the hint about renice and nice, that’s pretty adequate.

 

Best,

Georgi

Recent Comments by admin

Prevent rsync cronjob to run multiple times via cronjob on Linux
Another way I just red on a blog is as follows:

 

$ crontab -l
* * * * * /path/to/cron.sh

The command above will, just as the first example, execute our PHP script every minute through a bash script. To prevent it from overlapping, it can also be changed to this.

$ crontab -l
* * * * * /usr/bin/pgrep -f /path/to/cron.sh > /dev/null 2> /dev/null || /path/to/cron.sh

The pgrep command will return false if it does not find a running process matching the first argument, /path/to/cron.sh. If it returns false, it'll process the second part of the OR comparison (the double vertical line, ||). If the running process was found, pgrep will return the Process ID (PID) and Bash will not continue to the second part of the OR statement since the first already returned true.

The trick here is to use very unique scriptnames. If the name is too generic (such as "cron.sh"), pgrep may return Process IDs from other running cron jobs and not execute the cron you wanted.


Prevent rsync cronjob to run multiple times via cronjob on Linux
Here is another life time example with flock:
 

*/5 * * * * /usr/bin/rsync –delete -a source_server:/source/path/ /dst/path/

Example using flock:

*/5 * * * * flock -xn /tmp/example.lock -c '/usr/bin/rsync –delete -a source_server:/source/path/ /dst/path/'


Create SFTP CHROOT Jail User for data transfer to better Linux shared web hosting server security
After reboot if you have remote filesystem mounted which for some reason mounted by mistake as read only or for some reason turned into readonly you can check for such behavior with a quick liner too

fs='/ /var /tmp /usr';
for i in $fs ; do cd $i; touch d2; if [ "$?" -eq 0 ]; then  echo " $i is writable"; else echo "$i is not writable"; fi; done


MobaXTerm: A good gnome-terminal like tabbed SSH client for Windows / Windows Putty Tabs Alternative
Other alternative to mobaxterm that is free software is MTPutty (Multi Tabbed Putty)


How to mount Windows share from command line (cmd.exe) on Microsoft Windows XP / Vista / 7

Sorry, I didn’t get your question?


Share this on:

No Responses to “Hey Marco,   Thanks for the hint about renice and nice, that’s …”

  1. Mr WordPress says:
    Unknown Unknown Unknown Unknown

    Hi, this is a comment.
    To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.

    View CommentView Comment