Page 1 of 1
Custom crontab: overwrite with updates?
Posted: Sun Mar 09, 2014 8:04 am
by jmcafee
Hi Boris,
I added a custom job to crontab that builds and uploads a clientraw.txt rapid fire update to my web server every 10 seconds. Do your minor rev updates ever overwrite crontab such that I would have to re-enter the job command?
Thanks.
Jim
Re: Custom crontab: overwrite with updates?
Posted: Thu Mar 20, 2014 1:15 am
by admin
may be. If you alter crontab you are on your own.
Re: Custom crontab: overwrite with updates?
Posted: Sat Mar 29, 2014 6:20 am
by jmcafee
Is it better putting a script in /etc/boot for the real time rapid fire updates?
I also run a cron job for weekly backups. Any advantage to use /etc/cron.* rather than crontab?
Thanks.
Re: Custom crontab: overwrite with updates?
Posted: Sun Mar 30, 2014 5:33 am
by jmcafee
I restored the crontab to your default installation config.
The custom jobs in /etc/cron.d, including rapid fire to my web site, seem to function just fine.
Boris, I would like to know how the cron.d jobs will survive an update. Thanks.
Re: Custom crontab: overwrite with updates?
Posted: Tue Apr 01, 2014 6:52 am
by jmcafee
OK, plowed through a bunch of older updates. The crontab in /etc/cron.d survives. Hope this will persist.
Re: Custom crontab: overwrite with updates?
Posted: Sat Apr 05, 2014 9:47 am
by meteo-quimper
Can you share your clientraw rapidfire script ?
Re: Custom crontab: overwrite with updates?
Posted: Tue Apr 15, 2014 9:38 am
by jmcafee
No doubt there are better ways to do this. However, this works perfect for me for rapid fire upload to my web page, and automated backups.
Here is the cron job:
Code: Select all
## Start section by James McAfee
# rapid fire upload of clientraw; each cycle takes about 10 seconds
* * * * * root /data/scripts/gensend.sh; sleep 8; /data/scripts/gensend.sh; sleep 8; /data/scripts/gensend.sh; sleep 8; /data/scripts/gensend.sh; sleep 8; /data/scripts/gensend.sh; sleep 8; /data/scripts/gensend.sh
#
## Runs backup jobs
# weekly
30 0 * * 6 root /data/scripts/backup_upload.sh weekly -DD
# monthly
0 1 1 * * root /data/scripts/backup_upload.sh monthly
# every 6 months
30 1 1 */6 * root /data/scripts/backup_upload.sh 6month -DD
# yearly
0 2 1 1 * root /data/scripts/backup_upload.sh yearly -DD
## End section by James McAfee
And gensend.sh script to generate the clientraw.txt file:
Code: Select all
#! /bin/sh
ULDIR=**** #put your upload dir here; since I run several MH clients I use this var as part of the common script
# Generate clientraw.txt
#
/srv/www/meteohtml.cgi /home/meteohub/clientraw.conf >/var/run/meteohub/clientraw.out
if [ $1 == '-w' ]; then cp /var/run/meteohub/clientraw.out /data/myweb/uploads/clientraw.txt; fi #cp only once/min to minimize flash wear
cp /var/run/meteohub/clientraw.out /var/run/meteohub/perm/clientraw.txt
mv /var/run/meteohub/clientraw.out "/var/run/meteohub/uploads/clientraw.txt"
# Upload files
#
[ -z "`ls /var/run/meteohub/uploads/`" ] || [ -n "`/bin/pidof /usr/bin/ncftpput`" ] || /usr/bin/ncftpput -f /data/scripts/login.conf -S .tmp -R -DD /$ULDIR /var/run/meteohub/uploads/* 2>&1 | /usr/bin/logger
And backup script:
Code: Select all
#! /bin/sh
BUNAME=$1.tar.gz
BUDIR=*** #put your backup dir here
LOGIN=/data/scripts/login.conf #login credentials are in this file
DELLOCALFILE=$2
cd /
tar czpf /data/transfer/meteohub.$BUNAME /data/weather/20* /data/export/dashboard.swf /data/export/dashboard.html /data/graphs /data/scripts etc/rsyncd.conf var/cron/tabs/root home/meteohub/esmtprc home/meteohub/meteohub.conf home/meteohub/logger.conf home/meteohub/wmr928eval.conf home/meteohub/wswin.conf home/meteohub/wd.conf 2>/dev/null
/usr/bin/ncftpput -f $LOGIN -S .tmp -V $DELLOCALFILE -m /$BUDIR /data/transfer/meteohub.$BUNAME 2>&1 | /usr/bin/logger
Re: Custom crontab: overwrite with updates?
Posted: Tue Apr 15, 2014 9:22 pm
by meteo-quimper
did you have more detail for the installation of the scripts ?
Re: Custom crontab: overwrite with updates?
Posted: Sat Apr 19, 2014 5:13 am
by jmcafee
meteo-quimper wrote:did you have more detail for the installation of the scripts ?
If you have knowledge of Linux, you should now how this all works. If you are not familiar, I suggest that you not attempt it. Boris will kill you (and maybe me) if you mess up his program.