Custom crontab: overwrite with updates?

Discussion of the Meteohub software package

Moderator: Mattk

Post Reply
jmcafee
Junior Boarder
Junior Boarder
Posts: 26
Joined: Sun Nov 11, 2012 12:11 pm

Custom crontab: overwrite with updates?

Post 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
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7878
Joined: Mon Oct 01, 2007 10:51 pm

Re: Custom crontab: overwrite with updates?

Post by admin »

may be. If you alter crontab you are on your own.
jmcafee
Junior Boarder
Junior Boarder
Posts: 26
Joined: Sun Nov 11, 2012 12:11 pm

Re: Custom crontab: overwrite with updates?

Post 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.
jmcafee
Junior Boarder
Junior Boarder
Posts: 26
Joined: Sun Nov 11, 2012 12:11 pm

Re: Custom crontab: overwrite with updates?

Post 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.
jmcafee
Junior Boarder
Junior Boarder
Posts: 26
Joined: Sun Nov 11, 2012 12:11 pm

Re: Custom crontab: overwrite with updates?

Post by jmcafee »

OK, plowed through a bunch of older updates. The crontab in /etc/cron.d survives. Hope this will persist.
User avatar
meteo-quimper
Junior Boarder
Junior Boarder
Posts: 20
Joined: Thu Jun 07, 2012 1:13 pm
Location: Quimper - FRance
Contact:

Re: Custom crontab: overwrite with updates?

Post by meteo-quimper »

Can you share your clientraw rapidfire script ?
jmcafee
Junior Boarder
Junior Boarder
Posts: 26
Joined: Sun Nov 11, 2012 12:11 pm

Re: Custom crontab: overwrite with updates?

Post 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
Last edited by jmcafee on Thu May 01, 2014 2:51 pm, edited 1 time in total.
User avatar
meteo-quimper
Junior Boarder
Junior Boarder
Posts: 20
Joined: Thu Jun 07, 2012 1:13 pm
Location: Quimper - FRance
Contact:

Re: Custom crontab: overwrite with updates?

Post by meteo-quimper »

did you have more detail for the installation of the scripts ?
jmcafee
Junior Boarder
Junior Boarder
Posts: 26
Joined: Sun Nov 11, 2012 12:11 pm

Re: Custom crontab: overwrite with updates?

Post 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.
Post Reply