HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripting question again
Operating System - HP-UX
1831562
Members
4173
Online
110025
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
09-19-2007 10:45 AM
09-19-2007 10:45 AM
scripting question again
Hello All,
I have this script in place in init.d and set that as start at boot. For some reason when this script is started as the sws user from the location(SWSBIN) it starts in 5 to 10 min.But during system startup it won't, it takes more time and starts once we issue control sequenses as ctrlc or d.
What would be the problem.Please advice
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Usage: $0 {start|stop|restart}"
exit 1
fi
SWSBIN=/export/host/application/sws/sws2007/bin
case "$1" in
'start')
echo "Starting swsis"
/bin/su - sws -c "$SWSBIN/swsis start"
;;
'stop')
echo "Stopping swsis"
/bin/su - sws -c "$SWSBIN/swsis stop"
;;
esac
#
I have this script in place in init.d and set that as start at boot. For some reason when this script is started as the sws user from the location(SWSBIN) it starts in 5 to 10 min.But during system startup it won't, it takes more time and starts once we issue control sequenses as ctrlc or d.
What would be the problem.Please advice
#!/bin/sh
if [ $# -ne 1 ]; then
echo "Usage: $0 {start|stop|restart}"
exit 1
fi
SWSBIN=/export/host/application/sws/sws2007/bin
case "$1" in
'start')
echo "Starting swsis"
/bin/su - sws -c "$SWSBIN/swsis start"
;;
'stop')
echo "Stopping swsis"
/bin/su - sws -c "$SWSBIN/swsis stop"
;;
esac
#
Learning ...
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2007 10:56 AM
09-19-2007 10:56 AM
Re: scripting question again
Is it on an NFS mount? May explain why it takes longer or doesn't run at startup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2007 11:02 AM
09-19-2007 11:02 AM
Re: scripting question again
It's almost ceratinly the use of "su - sws ..." as opposed to "su sws ...". I know you want that "-" so that the user's .profile will be sourced and environment variables will be set BUT it's the .profile that is killing you. By default, .profile contains commands line tset, tabs, tput, and stty which expect stdin to be a TTY device (a terminal) --- which you ain't under rc.
You have two approaches:
1) In sws's .profile surrond those commands with:
if [[ -t 0 ]]
then
tset ...
stty
tabs
fi
which will only execute those commands when stdin is a terminal.
2) Create a small file that sets and exports your variable and let both your rc'ed script and sws's .profile source the file using the "." operator.
I actually like the second approach because it works from cron'ed scripts, .profile's, and rc'ed tasks.
You have two approaches:
1) In sws's .profile surrond those commands with:
if [[ -t 0 ]]
then
tset ...
stty
tabs
fi
which will only execute those commands when stdin is a terminal.
2) Create a small file that sets and exports your variable and let both your rc'ed script and sws's .profile source the file using the "." operator.
I actually like the second approach because it works from cron'ed scripts, .profile's, and rc'ed tasks.
If it ain't broke, I can fix that.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP