HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Not able to run script in init.d
Operating System - HP-UX
1834144
Members
2054
Online
110064
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
02-23-2008 10:30 AM
02-23-2008 10:30 AM
Not able to run script in init.d
hi all ,
i created a script but not able to initialize those ?
# root@dbsrv12 /sbin/init.d [3]cat omsagent #!/sbin/sh # # # Automated script to start and stop OMS 10g Intelligent Agent #
# Allowed exit values:
# 0 = success; causes "OK" to show up in checklist.
# 1 = failure; causes "FAIL" to show up in checklist.
# 2 = skip; causes "N/A" to show up in the checklist.
# Use this value if execution of this script is overridden
# by the use of a control variable, or if this script is not
# appropriate to execute for some other reason.
# 3 = reboot; causes the system to be rebooted after execution.
# 4 = background; causes "BG" to show up in the checklist.
# Use this value if this script starts a process in background
mode.
# Input and output:
# stdin is redirected from /dev/null
#
# stdout and stderr are redirected to the /etc/rc.log file
# during checklist mode, or to the console in raw mode.
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
# NOTE: If your script executes in run state 0 or state 1, then /usr might
# not be available. Do not attempt to access commands or files in
# /usr unless your script executes in run state 2 or greater.
Other
# file systems typically not mounted until run state 2 include
/var
# and /opt.
rval=0
# Check the exit value of a command run by this script. If non-zero, the # exit code is echoed to the log file and the return value of this script # is set to indicate failure.
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "EXIT CODE: $x"
rval=1 # script FAILed
fi
}
case $1 in
'start_msg')
# Emit a _short_ message relating to running this script with
# the "start" argument; this message appears as part of the checklist.
echo "Starting OMS 10g Intelligent Agent"
;;
'stop_msg')
# Emit a _short_ message relating to running this script with
# the "stop" argument; this message appears as part of the checklist.
echo "Stopping OMS 10g Intelligent Agent"
;;
'start')
# Execute the commands to start your OMS Agent subsystem
echo "Starting OMS 10g Intelligent Agent"
su - oracle -c "/u01/app/oracle/product/agent10g/bin/emctl start agent"
set_return
;;
'stop')
# Execute the commands to stop your subsystem
echo "Stopping OMS 10g Intelligent Agent"
su - oracle -c "/u01/app/oracle/product/agent10g/bin/emctl stop agent"
set_return
;;
*)
echo "usage: $0 {start|stop}"
rval=1
;;
esac
exit $rval
# ------- End of script ---------
i am using this script in init.d but it's not running on reboot while when i try to run the same manually i am able to start the service.
thanks in advance.
titu
i created a script but not able to initialize those ?
# root@dbsrv12 /sbin/init.d [3]cat omsagent #!/sbin/sh # # # Automated script to start and stop OMS 10g Intelligent Agent #
# Allowed exit values:
# 0 = success; causes "OK" to show up in checklist.
# 1 = failure; causes "FAIL" to show up in checklist.
# 2 = skip; causes "N/A" to show up in the checklist.
# Use this value if execution of this script is overridden
# by the use of a control variable, or if this script is not
# appropriate to execute for some other reason.
# 3 = reboot; causes the system to be rebooted after execution.
# 4 = background; causes "BG" to show up in the checklist.
# Use this value if this script starts a process in background
mode.
# Input and output:
# stdin is redirected from /dev/null
#
# stdout and stderr are redirected to the /etc/rc.log file
# during checklist mode, or to the console in raw mode.
PATH=/usr/sbin:/usr/bin:/sbin
export PATH
# NOTE: If your script executes in run state 0 or state 1, then /usr might
# not be available. Do not attempt to access commands or files in
# /usr unless your script executes in run state 2 or greater.
Other
# file systems typically not mounted until run state 2 include
/var
# and /opt.
rval=0
# Check the exit value of a command run by this script. If non-zero, the # exit code is echoed to the log file and the return value of this script # is set to indicate failure.
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "EXIT CODE: $x"
rval=1 # script FAILed
fi
}
case $1 in
'start_msg')
# Emit a _short_ message relating to running this script with
# the "start" argument; this message appears as part of the checklist.
echo "Starting OMS 10g Intelligent Agent"
;;
'stop_msg')
# Emit a _short_ message relating to running this script with
# the "stop" argument; this message appears as part of the checklist.
echo "Stopping OMS 10g Intelligent Agent"
;;
'start')
# Execute the commands to start your OMS Agent subsystem
echo "Starting OMS 10g Intelligent Agent"
su - oracle -c "/u01/app/oracle/product/agent10g/bin/emctl start agent"
set_return
;;
'stop')
# Execute the commands to stop your subsystem
echo "Stopping OMS 10g Intelligent Agent"
su - oracle -c "/u01/app/oracle/product/agent10g/bin/emctl stop agent"
set_return
;;
*)
echo "usage: $0 {start|stop}"
rval=1
;;
esac
exit $rval
# ------- End of script ---------
i am using this script in init.d but it's not running on reboot while when i try to run the same manually i am able to start the service.
thanks in advance.
titu
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2008 11:20 AM
02-23-2008 11:20 AM
Re: Not able to run script in init.d
Do you have links to the /sbin/init.d script in /sbin/rc3.d? Go to /sbin/rc3.d and do an 'll'. You will notice that there are S* and K* scripts which are links back to scripts in /sbin/init.d.
The 'S*' scripts are run at startup and the K* scripts are run at shutdown. The numbers after the S and the K in the link name determine the order in which they are run. S950start will run before S999*, etc. The common convention is for the numbers in the S* and K* links for a particular script to add up to 1000.
So if you want this script to run as part of the run level 3 startup you should do:
# cd /sbin/rc3.d
# ln -s /sbin/init.d/omsagent S980omsagent
And to have it shutdown when you do a shutdown:
# cd /sbin/rc3.d
# ln -s /sbin/init.d/omsagent K020omsagent
The 'S*' scripts are run at startup and the K* scripts are run at shutdown. The numbers after the S and the K in the link name determine the order in which they are run. S950start will run before S999*, etc. The common convention is for the numbers in the S* and K* links for a particular script to add up to 1000.
So if you want this script to run as part of the run level 3 startup you should do:
# cd /sbin/rc3.d
# ln -s /sbin/init.d/omsagent S980omsagent
And to have it shutdown when you do a shutdown:
# cd /sbin/rc3.d
# ln -s /sbin/init.d/omsagent K020omsagent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2008 12:18 AM
02-25-2008 12:18 AM
Re: Not able to run script in init.d
Patrick thanks for response , i will follow the steps and will update in thread.
Titu
Titu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2008 11:23 PM
02-26-2008 11:23 PM
Re: Not able to run script in init.d
it helped a lot
thanks for reply.
titu
thanks for reply.
titu
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