I'm running these commands on crontab and it seems that the script are not running every 5 minutes
5 * * * /etc/my_scripts/telnet.sh | telnet >> /tmp/top_Jay.txt
5 * * * /etc/my_scripts/telnet_lab.sh | telnet >> /tmp/top_Lab.txt
I'm running these commands on crontab and it seems that the script are not running every 5 minutes
5 * * * /etc/my_scripts/telnet.sh | telnet >> /tmp/top_Jay.txt
5 * * * /etc/my_scripts/telnet_lab.sh | telnet >> /tmp/top_Lab.txt
5 * * * * .../script means to run .../script at 5 mins past every hour.
*/5 * * * * .../script means to run the script every 5 minutes.
Also, I'm not entirely sure whether the pipe to telnet will work in cron (it depends on whether your cron forks a shell to run your command or not). You'd be better off rewriting your script so that the pipe to telnet occurs inside the script (which can be as simple as wrapping it in ( ... ) | telnet....and you'd certainly be better off rewriting your script as an expect script rather than a shell script - expect is designed for exactly this kind of job.
You need another * before command
The columns are
mins, hrs, day of month, month of year, day of week, command
You need one more *
The format is:
Update
Also if you just put 5 in the first field, your command will only be executed 5 minutes after the full hour. To have it executed every 5 minutes it should be */5
/etc/my_scripts/telnet.sh and /etc/my_scripts/telnet_lab.sh executable?
The syntax should have 5 fields :
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
You need to add one star. The crontab spec says that there are 5 fields for the time specification.