Quote:
Originally Posted by kenoshi
Control it through your script, tried and true way would be:
Code:
if [ -e /tmp/already_started ]; then
echo "I am already running as $(< /tmp/already_started), exiting" >> /tmp/some_error_log
exit 1
else
echo $$ > /tmp/already_started
do_your_thang
rm -f /tmp/already_started
fi
|
Thank you very much!! That was exact the code i was looking for.
Because to install flock ect. on my linkstation, my knowledge wasn't good enough ;-)
I am using(now) a linkstation mini(LS-WSGL) with rsync, that automatically sync to my online-storage(Strato Hidrive).
I edit my cronjob like this:
Code:
cd /etc/cron
crontab -e
I added following line:
Code:
*/1 * * * * /mnt/array1/share/rsync_hidrive_setup.sh
My rsync_hidrive_setup.sh looks like this:
Code:
#!/bin/bash
if [ -e /mnt/array1/share/already_started ]; then
echo "I am already running as $(< /tmp/already_started), exiting" >> /tmp/some_error_log
exit 1
else
echo $$ > /mnt/array1/share/already_started
rsync --delete --exclude=.* -avubzre ssh -i /root/.ssh/id_rsa /mnt/array1/share/rsync BENUTZER@rsync.hidrive.strato.com:/users/BENUTZER --backup-dir=deleted_rsync
rm -f /mnt/array1/share/already_started
fi