SUMMARY: Calling su from cron

From: Smith, Kevin <kevin.m.smith_at_siemens.com>
Date: Tue Aug 10 2004 - 05:34:58 EDT
Thanks to Chris Pinnock, Nick Figaro & David Logan.

Solution: Source in any required environment variables prior to running a
script that contains a "su - USER -c COMMAND" via cron.

<<

All,

I have discovered that if you call "su - USER -c COMMAND_STRING" from a
script that is executed by cron, the USER environment is not loaded [as it
would be if you called su - USER from a shell]. 

Is this a feature or is it by design? I have got round the problem by
exporting the required variables as part of the command string parsed to "su
- USER -c COMMAND_STRING"

<<

      ---------------------------------------------------
	Kev Smith
	Unix Systems Administrator. 
	Operational Support, IND Croydon.

	E-Mail:	kevin.m.smith AT siemens.com
	Tel:	020 8760 3358
	Mob: 	07808 828595
	---------------------------------------------------

	This e-mail contains confidential information and is for the
exclusive use of the addressee/s. If you are not the addressee, then any
distribution, copying or use of this e-mail is prohibited. If received in
error, please advise the sender and delete it immediately. We accept no
liability for any loss or damage suffered by any person arising from use of
this e-mail.

Siemens Business Services Limited
Registered No: 1203466 England
Registered Office: Siemens House, Olbury, Bracknell,  Berkshire, RG12 8FZ
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Tue Aug 10 05:35:59 2004

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:36 EST