Cron Job Help

Level 1 is known as the linux guru community so I need some help!!!

Need to create a cron job on a linux server to SSH over to a different device and run a certain command on a 4hr timer. I have the timer written… I think? But I honestly have no clue how to write the bash script to execute it. This is in a CentOS based linux server.

Here is the cron job I came up with based on quick research.

30 0,4,8,12,16,20 * * * /root/bash script file

From my understanding, this should tell the server that at 30 minutes past every 4hrs it should execute correct?

Its simple, its needs to SSH over to the device and run a single command and thats it. Any help would be greatly appreciated.

It may be easier and more secure to set up the cron job on the machine locally since you will need a PW to SSH. I believe the cron script will be in plain text.

1 Like

Unfortunately, I dont think setting it up locally will work? Its on a Cisco device that I need to have the command executed on.

so after searching more and doing more and more research, I was able to find a way to get a KRON job up on the Cisco device that should do the trick I need.

1 Like

Cool beans man gonna set this to auto close in 24 hours

FYI: If you want to have a cron job execute every four hours, you can use */4 instead of 0,4,8,16,20:

30 */4 * * * /root/bash script file

*/4 in the hour field means “every hour evenly divisible by 4”

This topic was automatically closed after 32 hours. New replies are no longer allowed.