- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Start script starts twice during transient fro...
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
09-09-2007 11:29 PM
09-09-2007 11:29 PM
1) In rc4.d I created link: /sbin/rc4.d/S999myscript that is a link to my own script created in: /sbin/init.d/myscript
2) my script does as follows:
#First: switches to user "myuser" and executes myscript.sh script as below:
#!/bin/sh
/usr/bin/su - myuser -c "/home/myuser/myscript.sh" >> /dev/null
#Second: It checks if previous command was successfully executed and if not it writes error to log... if yes it sends good notice to log as example below:
x=$?
if [ "$x" -gt 0 ]; then
echo "myscript failed to start" > /home/myuser/myscript.log
else
echo "myscript started"
exit 0
fi
3)Finally in /home/myuser/myscript.sh script is following action taken - start program:
nohup ./start_binary_program &
exit 0
Now I tested few scenarios and the most important and problematic for me is that
when I start it manually from command line:
./S999myscript
I see process of my_binary_program running once.
When I go from run level 3 to run level 4 I can see two processes of my_binary_program started the same time... exact started almost in the same second...
I checked rc.log and I confirm that somehow... this start script is called two times......
I can say it after following test:
I modified /sbin/init.d/myscript by adding one line that writes current date to /tmp/out.log
as follows: date >> /tmp/out.log.
So the script looks like:
#!/bin/sh
date >> /tmp/out.log
/usr/bin/su - myuser -c "/home/myuser/myscript.sh" >> /dev/null
x=$?
if [ "$x" -gt 0 ]; then
echo "myscript failed to start" > /home/myuser/myscript.log
else
echo "myscript started"
exit 0
fi
Maybe you could help somehow becaus at this stage I don't have more ideas what can be wrong...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2007 11:37 PM
09-09-2007 11:37 PM
Re: Start script starts twice during transient from 3 -> 4 level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2007 11:38 PM
09-09-2007 11:38 PM
Re: Start script starts twice during transient from 3 -> 4 level
Make sure that you haven't inadvertantly created multiple startup links to your script:
# ls -lR /sbin/rc?.d|grep myscript
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2007 11:45 PM
09-09-2007 11:45 PM
Re: Start script starts twice during transient from 3 -> 4 level
1. In the rc4.d/ is only my S999myscript script and another link
with S301 prefix that does (starts) different think related to system resources and surely not related to my staff
(I can comment -t out _S301 to prove that it is not related to my problem)
2. Exactly one link only... 100% sure...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 12:01 AM
09-10-2007 12:01 AM
Re: Start script starts twice during transient from 3 -> 4 level
1. Create a new startup script in /sbin/init.d. The only action needed is to log the time stamp.
2. Create a symbolic link in /sbin/rc4.d as usual
3. Test the new script
If the new script exhibits the expected behaviour, focus on your "myscript". If not, /sbin/rc might have a bug (I never found that).
Good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 12:17 AM
09-10-2007 12:17 AM
Re: Start script starts twice during transient from 3 -> 4 level
In /sbin/rc4.d
S998scripta -> /sbin/init.d/myscripta
where
/sbin/init.d/myscripta
is just:
echo test >> /tmp/test.out
I go to init 3...
Tests starts now:
init 4
I do more /tmp/test.out
test
test
Seems test written two time to file... That means taht S998scripta is called twice...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 02:44 AM
09-10-2007 02:44 AM
Re: Start script starts twice during transient from 3 -> 4 level
This was probably my misunderstanding.
I read more carefully...
start script I have written havent contain
following syntax...
probably this was the problem.
Now I checking last reboot... but I think it is right...:
case
start_msg)
stop_msg)
start)
stop)
*)
esac
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 05:01 AM
09-10-2007 05:01 AM
SolutionBill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2007 07:15 PM
09-10-2007 07:15 PM