Is cron usable?
- This topic has 2 replies, 2 voices, and was last updated 11 years, 7 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forums › MultiConnect OCG › Is cron usable?
Hello,
I am using a MultiTech OCG-D (MTDCDP-H5-GP) with an AT&T m2m sim card.
I have written a bash script that initiates a pppd connection through the cellular modem, and then posts data to remote web database through curl. I would like this to occur on a regular basis (initial testing phase would be 5, 10 or 15 minutes… implementation would be every 12 hours). This works on demand. However, I assumed I could put it in as a cron job as such:
*/5 * * * * /home/root/post2mysql.sh
This doesn’t seem to run every 5 minutes as anticipated. Did I do something wrong? Is there another place that the multitech hardware would like me to schedule tasks.
Thanks.
– Ben
Hi Ben,
Would you pls look at the /var/log/messages and see if it is executing your script every 5 mins ? If it does, but your script is not running, then pls check your script file permission. Do the command ls to list out your script’s file permission. It should have exec file permission set.
If not, you can use the command chmod to add exec file permission to your script.
Thanks,
BT
Bryan,
Thanks for the reply. I did end up getting it worked out. I added:
#!/bin/bash
and also a PATH deceleration (don’t have access to the gateway device at the moment so I can’t quote the exact) at the top of my script and that worked. Turns out the environmental variables are different for the user trying to run the cron job then the user logged in as root. By setting the BASH reference I ensure its interpreted properly and by setting the PATH reference I allow for the system to find the commands I use in the script. Can’t say whether it was the BASH or the PATH deceleration that actually fixed it. But having both probably makes for better coding practice anyways.
Thanks!
– Ben