- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- start stop scripts for application
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
03-05-2008 01:50 AM
03-05-2008 01:50 AM
start stop scripts for application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2008 03:26 AM
03-05-2008 03:26 AM
Re: start stop scripts for application
try running "su $USERNAME -c $COMMAND".
Hope this helps.
Best regards,
Patrick
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2008 05:14 AM
03-05-2008 05:14 AM
Re: start stop scripts for application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2008 07:09 AM
03-05-2008 07:09 AM
Re: start stop scripts for application
Also need to shutdown the applications as the same user on system shutdown.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2008 07:57 AM
03-05-2008 07:57 AM
Re: start stop scripts for application
su -c '/home/jim/application' jim &
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2008 04:46 PM
03-05-2008 04:46 PM
Re: start stop scripts for application
/etc/init.d/myapp:
-------------
#!/bin/sh
#
# chkconfig: 235 99 10
# description: myapp Startup/Shutdown Script
case "$1" in
start)
su -c "/app/start_myapp - USERID
touch /var/lock/subsys/myapp
;;
stop)
su -c "/app/stop_myapp - USERID
rm -f /var/lock/subsys/myapp
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
-------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2008 07:08 PM
03-05-2008 07:08 PM
Re: start stop scripts for application
It will do basically the same thing for what you're intending, but bypasses some of the PAM checks.
If you're on a RedHat/Centos system, you might also want to use the built-in 'functions' that are available to the init.d startup/shutdown commands, in particular the 'daemon' command (with the '--user
The 'killproc' routine however doesn't have any as-user support however.