Jordan Boxer
Cadet
- Joined
- Dec 20, 2016
- Messages
- 6
Hi,
I have a script that is designed to pull a couple of spreadsheets via a curl request. I've tested the script multiple times and works perfectly within the shell, however when I try to set it up as a cron job, not only does the script not run at the specified time, it doesn't run at all even when I tell it to "Run Now." I have set the file permissions to 777 and tried multiple syntax changes to my script and I'm still getting nothing.
Here is my /etc/crontab file (the script is fetch-spreadsheet.sh):
Here is my script (with the curl requests edited for security purposes):
So what gives? I'm honestly totally stuck right now and I'm not sure what to do. Any help would be much appreciated.
PS: I set up the cron job via the GUI
Thanks,
Jordan
I have a script that is designed to pull a couple of spreadsheets via a curl request. I've tested the script multiple times and works perfectly within the shell, however when I try to set it up as a cron job, not only does the script not run at the specified time, it doesn't run at all even when I tell it to "Run Now." I have set the file permissions to 777 and tried multiple syntax changes to my script and I'm still getting nothing.
Here is my /etc/crontab file (the script is fetch-spreadsheet.sh):
Code:
# SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin # #minute hour mday month wday who command # */5 * * * * root /usr/libexec/atrun > /dev/null 2>&1 # # Save some entropy so that /dev/random can re-seed on boot. */11 * * * * operator /usr/libexec/save-entropy > /dev/null 2>&1 # # Rotate log files only at midnight. 0 0 * * * root newsyslog > /dev/null 2>&1 # # Perform daily/weekly/monthly maintenance. 1 3 * * * root periodic daily 15 4 * * 6 root periodic weekly 30 5 1 * * root periodic monthly # # Adjust the time zone if the CMOS clock keeps local time, as opposed to # UTC time. See adjkerntz(8) for details. 1,31 0-5 * * * root adjkerntz -a > /dev/null 2>&1 0 * * * * root /bin/sh /usr/local/sbin/save_rrds.sh > /dev/null 2>&1 5 3 * * * root /bin/sh /usr/local/bin/telemetry-cron.sh > /dev/null 2>&1 0 * * * * root /usr/local/bin/python /usr/local/bin/mfistatus.py > /dev/null 2>&1 1,31 * * * * root /usr/local/bin/python /usr/local/www/freenasUI/tools/alert.py > /dev/null 2>&1 15 3 * * * root /usr/local/bin/python /usr/local/www/freenasUI/tools/cachetool.py expire >/dev/null 2>&1 30 3 * * * root /usr/local/bin/python /usr/local/www/freenasUI/tools/cachetool.py fill >/dev/null 2> &1 45 3 * * * root /usr/local/bin/python /usr/local/www/freenasUI/middleware/notifier.py backup_db >/de v/null 2>&1 0 3 * * * root find /tmp/ -iname "sessionid*" -ctime +1d -delete > /dev/null 2>&1 30 */5 * * * root /etc/ix.rc.d/ix-kinit renew > /dev/null 2>&1 */10 * * * * root [ -s /tmp/mail.queue ] && /usr/local/bin/python /usr/local/www/freenasUI/tools/mailq ueue.py 45 3 * * * root /usr/local/libexec/nas/scrub -t 35 freenas-boot 21 15 * * 1,2,3,4,5 root PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin " /mnt/Vol001/scripts/fetch-spreadsheet.sh > /dev/null 00 00 * * 7 root PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /usr/l ocal/libexec/nas/scrub -t 35 Vol001 * * * * * root /usr/local/bin/python /usr/local/www/freenasUI/tools/autosnap.py > /dev/null 2>&1 14 1 * * * root /usr/local/bin/python /usr/local/www/freenasUI/tools/update_check.py > /dev/null 2>& 1 @weekly root /usr/local/sbin/update-smart-drivedb > /dev/null 2>&1
Here is my script (with the curl requests edited for security purposes):
Code:
#!/bin/sh # currentdate=$( date "+%Y-%m-%d" ) previousdate=$( date -v-3d "+%Y-%m-%d" ) yesterdaydate=$( date -v-1d "+%Y-%m-%d" ) filename1=analysis-${currentdate}.xlsx filename2=transactions-${currentdate}.xlsx filename3=analysis-${yesterdaydate}.xlsx filename4=transactions-${yesterdaydate}.xlsx echo echo "Fetching $filename1" echo curl -u xxx:xxx -O "xxx" "https://www.xxx.com/api/xxx" -o $filename1 echo echo "Fetching $filename2" echo curl -u xxx:xxx -O "xxx" "https://www.xxx.com/api/xxx" -o $filename2 echo echo "Deleting yesterday's file: $filename3" echo rm $filename3 echo echo "Deleting yesterday's file: $filename4" echo rm $filename4
So what gives? I'm honestly totally stuck right now and I'm not sure what to do. Any help would be much appreciated.
PS: I set up the cron job via the GUI
Thanks,
Jordan
Last edited: