- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: want to use su within cron to run as another u...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2007 09:41 AM
05-31-2007 09:41 AM
The generic user login is notrig (home/notrig)
My syntax for crontab is:
30 01 01 * * /usr/bin/su - notrig /home/notrig/program >/tmp/notrig.program.out 2>&1
Any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2007 09:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2007 10:00 AM
05-31-2007 10:00 AM
Re: want to use su within cron to run as another user
Since you are going to cause your '.profile' to be sourced (read), you should modify your '.profile' to only conditionally execute its terminal-handling logic --- the 'stty' and 'tset' commands --- when the process is associated with a terminal. This will eliminate the annoying "not a typewriter" output you will otherwise get.
To test if your process is associated with a terminal, you can do (for the purposes here):
if [ -t 0 ]; then
...
fi
...When the above is true, the process is associated with a terminal and it is "safe" to execute 'stty' and 'tset' commands.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2007 10:00 AM
05-31-2007 10:00 AM
Re: want to use su within cron to run as another user
Where did you find that -c option?
I didn't see it in any of the man pages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2007 10:17 AM
05-31-2007 10:17 AM
Re: want to use su within cron to run as another user
"Execute the command, 'echo hello', using the temporary environment and permissions of user bin. In this example, user bin's shell is invoked with the arguments -c 'echo hello'.
su bin -c 'echo hello'
"
-c is argument to shell, not to su.
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2007 10:21 AM
05-31-2007 10:21 AM
Re: want to use su within cron to run as another user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2007 03:39 AM
06-01-2007 03:39 AM
Re: want to use su within cron to run as another user
Where in a .profile would I place
if [ -t 0 ]; then
...
fi
to keep from getting errors like
more infx.ccnotice.out
ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter
^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2
^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2 ^[2
^[2 ^[2
stty: : Not a typewriter