Forum Moderators: bakedjake
I want to call a binary app, call it "/home/jedi/trillian" once a minute, every hour, every day, every week etc.
I have my editor set to nano (I can hear the hisses, but I don't use *nix enough to really know Vi all that well ;-)).
So, I do:-
crobtab -e
Which brings up my current schedule list in nano. As I understand it, the first 5 fields refer to minutes/hours/day of week/weeks/user etc, with asterisks as wildcards.
So to call my app once per minute I think what I need to add is this:-
01 * * * * /home/jedi/trillian
So I add that, exit nano saving changes.
Then a crontab -l will list my jobs just to make sure that it's in there.
Is that it? Or do I need to tell CRON to reload it's schedule list or anything else?
Also, does my CRON entry look right?
This is in roots CRON schedule, so I do the crontab -e while logged in as root. My application needs to be run as root. Do I need to specify that, or as it's roots cron sched anyway, can I leave it?
The applications rights were set with a "chmod u+x trillian", while logged in as root.
Many thanks,
TJ
It seems that CRON doesn't recognise Roots environment variables, so the app is failing.
I can't find a way to set user prefs/variables. Is there a way to tell CRON to use Roots env variables, or can I set it in a bash script somehow?
Basically, I need roots CRON schedule to work just as if I'm executing apps from shell.
Thanks,
TJ
I'm not sure what an "overuse of CPU" email is though? It's my server, surely I can do what I like with the CPU? Any host that sent me an email like that would not remain my host for very long ;-)
I'm still having problems setting the environment variables - really I want CRON to act just as bash does when I'm logged in as root at the command line via SSH.
TJ
If you want stuff run out of the root crontab, then start the "crontab -e" from the root user. That's for the user context (permissions, etc).
If you need the user's login envorinment, then try this:
* * * * * /path/to/bash --login -c "/your/script"
Caution advised with scripts to be run by root: set the file permissions to /your/script very tight (owner root:root, -rwx------), so that other users can not run in root context what they want by just appending own stuff to your script!
Regards,
R.
I was refering to multi user machines ..:) I used to have an incredible problem when I was hosting people ..they'd see the cron button in cpanel ..think "what does this do" .."lets see/play" ..and the server would just sit down and sulk ..( of course the non "playing" clients on the same machine would be overjoyed at the speeds )..and I would get the emails then ..rapidos!
Even when it was written up clear "if you don't know what you are doing in cron don't do anything" they still did!
I wonder what it is about "don't touch" notices ..
"eve" complex? :)