- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: su - app_user from oracle cronjobs (in a scrip...
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-08-2002 08:03 AM
05-08-2002 08:03 AM
I am running this script from oracle cron.
But within the script I need to su to another user and run that command as that user.How do I do it. See example below.
su - app_user -c command
If i run this command manually from the command line as oracle user, it asks me for a passwd of app_user, which I know but do not know how to put it in a script.
Help neeeded on this please.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 08:05 AM
05-08-2002 08:05 AM
Re: su - app_user from oracle cronjobs (in a script)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 08:08 AM
05-08-2002 08:08 AM
Re: su - app_user from oracle cronjobs (in a script)
HTH
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 08:15 AM
05-08-2002 08:15 AM
Re: su - app_user from oracle cronjobs (in a script)
If $user is not root, then
you can try this:
1. Edit ~app_user/.rhosts so it includes:
$host $user
2. As $user, run:
remsh $host -l app_user -n "command"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 08:17 AM
05-08-2002 08:17 AM
Re: su - app_user from oracle cronjobs (in a script)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 08:19 AM
05-08-2002 08:19 AM
Re: su - app_user from oracle cronjobs (in a script)
run as a cron for root and then su to oracle or the user it wont ask for passwd.
Here is what I do to with my crons :
echo " merge started " | sendmail 5712157544@mobile.att.net
su - oracle -c "/home/oracle/report_bkup/ShutDB PBSCS" > /tmp/mergelog
su - oracle -c "/home/oracle/report_bkup/ShutDB PRTX" >> /tmp/mergelog
/usr/local/adm/bcv/umount_bcv.ksh bcvgrp1 M3 >> /tmp/mergelog
/usr/local/adm/bcv/umount_bcv.ksh bcvgrp2 M3 >> /tmp/mergelog
/usr/local/adm/bcv/merge_bcv.ksh bcvgrp1 M3 >> /tmp/mergelog
/usr/local/adm/bcv/merge_bcv.ksh bcvgrp2 M3 >> /tmp/mergelog
echo " merge completed " | sendmail 5712157544@mobile.att.net
/usr/local/adm/bcv/cond
exit
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 10:30 AM
05-08-2002 10:30 AM
Re: su - app_user from oracle cronjobs (in a script)
If possible, run the script/command under application user's cronjob.
Prashant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 11:24 AM
05-08-2002 11:24 AM
Re: su - app_user from oracle cronjobs (in a script)
I can't run it as root crontab. Is using root cron (and then su' ing to another user) only way to do it ?
The below command does not work as it still
prompts for a passwd.
=====================
$ id
uid=101(oracle) gid=101(dba) groups=102(www)
$ echo "password" | su - app_user -c halt_cmd
Password:
su: Sorry
==================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 12:39 PM
05-08-2002 12:39 PM
Re: su - app_user from oracle cronjobs (in a script)
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 12:55 PM
05-08-2002 12:55 PM
Re: su - app_user from oracle cronjobs (in a script)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2002 04:34 AM
05-10-2002 04:34 AM
Re: su - app_user from oracle cronjobs (in a script)
You should have the relevant permissions.
You can restrict execution with ACLs if you wish to do so.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2002 06:25 AM
05-10-2002 06:25 AM
Re: su - app_user from oracle cronjobs (in a script)
You can try expect to supply the password for the user id. You may have to look into more detail in this link to see if this suits your purpose,
http://expect.nist.gov/
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2002 06:27 AM
05-10-2002 06:27 AM
SolutionHere is another link to download expect,
http://hpux.cs.utah.edu/hppd/hpux/Tcl/expect-5.33/
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2002 06:29 AM
05-10-2002 06:29 AM