Kyle Chickering

Cronjob Not Working

Discussion created by Kyle Chickering on Feb 20, 2018
Latest reply on Feb 21, 2018 by Dameon Welch-Abernathy

Hey guys,


So, I want to setup a couple cronjobs to run a few bash scripts on my gateways. One being the I then created an export script to take the two files it creates and export it to an FTP server.


Both of my shell scripts can be executed manually but when I try to setup cronjobs, they don't work. I created a user called jobuser to execute these.


[Expert@host]# crontab -u jobuser -l
0 1 1 1-12 * /home/admin/
0 2 1 1-12 * /home/admin/
25 3 * * * /home/admin/


Here you can see I have two schedules, one to run the healthcheck first then to run the export, then I have a third that I was just testing with live to see why or why it isnt working. 


After this I also created a healthjob cron in etc/cron.d and chmod 664 to give it proper permissions.


Referencing How to create a cron job on SecurePlatform OS that runs every minute 


[Expert@host]# cd /etc/cron.d/
[Expert@host]# ls -al
total 24
drwx------ 2 admin root 4096 Feb 16 16:55 .
drwxr-xr-x 47 admin root 12288 Feb 13 08:41 ..
-rw-rw-r--  1 admin root 51 Feb 16 16:55 healthjob
-rw-r--r-- 1 admin root 188 Jan 31 2008 sysstat
[Expert@host]# cat healthjob
56 16 * * * root /home/admin/


When I restart the cron service and tail /var/log/cron I get BAD FILE MODE which just means permission issue as far as I know in the unix. I even chmod to 777 for fun and no luck.


Feb 20 10:50:15 2018 host crond[31840]: (*system*) BAD FILE MODE (/etc/cron.d/healthjob)


I also made sure that both my scripts start with !#bin/bash I've also tried adding -f -x but that isn't recognized


Any help would be greatly appreciated.