Operating System - HP-UX
1848033 Members
3108 Online
104022 Solutions
New Discussion

Survey: Best Practice on cronjob location

 
Terrence
Regular Advisor

Survey: Best Practice on cronjob location

So what's the consensus on where to put root scripts run by cron. Lets limit the discussion to just system administration/housekeeping tasks.

I'm of the opinion /root/cron (Or /home/root/cron)

Opinions?
11 REPLIES 11
Simon Hargrave
Honored Contributor

Re: Survey: Best Practice on cronjob location

Don't think it really matters where you put them. Just make SURE they're not world or group writable, otherwise you're asking for trouble!

For reference I currently use /usr/local/housekeeping/. Also if you package them up in a bundle, you can easily distribute them to all your servers. I'd prefer to use /root/ for temporary scripts.

It's all personal opinion really, no hard-and-fast rules, except the permissions!
Robert-Jan Goossens
Honored Contributor

Re: Survey: Best Practice on cronjob location

/usr/local/bin /usr/local/sbin

Regards,
Robert-Jan
Patrick Wallek
Honored Contributor

Re: Survey: Best Practice on cronjob location

Hmm...That depends. Are these scripts JUST run by cron? Are they ever used interactively by the sys admin?

For root / sys-admin / house cleaning scripts I prefer /home/root/scripts.

If you have things that are ONLY run from cron, I might then use /home/root/cron, but I have very few like that.
Steven E. Protter
Exalted Contributor

Re: Survey: Best Practice on cronjob location

Since most of the scripts I run with cron are developed at home, I keep them here:

/usr/contrib/bin

Because they are user contributed scripts, with the user sometimes being a dba, me or even a programmer.

We keep oracle scripts in a different location, as well as other applications. Still, in general, /usr/contrib/bin works for us.

We keep permissions tight so syadmin has control of what code runs.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
RAC_1
Honored Contributor

Re: Survey: Best Practice on cronjob location

I agree with you tererence. I prefer to have a separte home dir for root. (I make it /home/root)

It is easy to manage and put all root related stuff there. As a root, I do lot os scripts, collect data and things like that. So I do not want to go on looking for it at different places. good to put it in /home/root or /root

Anil
There is no substitute to HARDWORK
H.Merijn Brand (procura
Honored Contributor

Re: Survey: Best Practice on cronjob location

We have them (only 2) in /pro/local/bin

/pro for PROCURA, where all is installed that is - well - needed for procura applications and not part of the base system

/usr/local/scripts might be a suggestion, but your /home/root/cron sounds sensible too

Maybe more important than where the *scripts* are located is where you gather the log(s)

/var/tmp
/var/cron.out
/tmp
/usr/tmp
/home/root/cron.out (bad choice IMHO)

or to mail

Whatever you choose, be sure you READ the log!


Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Pete Randall
Outstanding Contributor

Re: Survey: Best Practice on cronjob location

Hi Terrence,

We keep a separate file system for all our applications called /apps, with it's own directory structure beneath to keep everything organized. Originally it was intended strictly for our own application programs, but after losing a script that was probably in /usr/local/bin (or something like that) during an install, I decided to take advantage of that separate file system for all my root scripts as well.


Pete

Pete
Geoff Wild
Honored Contributor

Re: Survey: Best Practice on cronjob location

I think location isn't as important as permissions.

For example, I have some cron jobs run as root, but the scripts are in SAP filesystems - like /APPL

For OS, most of mine are in /usr/local/bin - with permissions 750

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Mark Greene_1
Honored Contributor

Re: Survey: Best Practice on cronjob location

We keep shell and perl scripts in /usr/scripts. All log and error files are written in /tmp/. We have /, /home /tmp, /var, and /usr as seperate file systems to avoid hanging the system. As little as possible is put in /, and nothing we develop ever writes to /var/tmp, again to avoid filing a file system via a run-away process.

In the past, I've seen OS upgrades on non-HP systems (IBM & DEC) wipe-out everything in /usr/local and in root's home directory, so out of longstanding habit I don't put anything in either of those locations if I can avoid doing so.

mark
the future will be a lot like now, only later
Prashant Zanwar_4
Respected Contributor

Re: Survey: Best Practice on cronjob location

/.root/Local/cron_scripts

This is what I do in my setup.

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
John Poff
Honored Contributor

Re: Survey: Best Practice on cronjob location

Hi,

Good question. We seem to keep ours in a few places:

/root_home/bin
/usr/local/bin
/opt/local/bin

We should standardize on one place, but we haven't. Maybe next time. :)

JP