LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-02-2011, 02:08 PM   #1
rvaede
LQ Newbie
 
Registered: Feb 2011
Posts: 20

Rep: Reputation: 0
startup script


I have set up a script in /etc/rc2.d to start up on reboot.
The script needs to run on reboot using ID: abcdef.

I placed an su - abcdef on top of the script and it didn't work.
I tried the script manually running the script using root and my
ID swithed from root to abcdef and the script never ran.
Any hints please.
I am using Redhat 5.5

regards
Roger
 
Old 03-02-2011, 02:27 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,185

Rep: Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586
Will you post the script?
 
Old 03-02-2011, 02:34 PM   #3
rvaede
LQ Newbie
 
Registered: Feb 2011
Posts: 20

Original Poster
Rep: Reputation: 0
Here it is

su - clearit
cd /clearx/clearx/bin
ps -ef | grep "clearxDaemon start"
if [ "$?" -ne "0" ]; then
./clearxDaemon start /clearx/clearx/
exit
fi
./clearxDaemon stop /clearx/clearx/
./clearxDaemon start /clearx/clearx/
 
Old 03-02-2011, 02:40 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,185

Rep: Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586
Honestly, from looking at what you are trying to do, you probably do not have to set this up as a service.

You can set it up in root's .bashrc OR /etc/rc.local

So put all of that in a script called somefilename.sh, then add this to rc.local
Code:
su clearx /home/clearx/somefilename.sh
Code:
somefilename.sh
--------------------------------------
cd /clearx/clearx/bin
ps -ef | grep "clearxDaemon start"
if [ "$?" -ne "0" ]; then
./clearxDaemon start /clearx/clearx/
exit
fi
./clearxDaemon stop /clearx/clearx/
./clearxDaemon start /clearx/clearx/
 
Old 03-02-2011, 03:12 PM   #5
rvaede
LQ Newbie
 
Registered: Feb 2011
Posts: 20

Original Poster
Rep: Reputation: 0
I tested that and it works. Thank you.
 
Old 03-02-2011, 03:13 PM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,185

Rep: Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586Reputation: 1586
Quote:
Originally Posted by rvaede View Post
I tested that and it works. Thank you.
Excellent. Mark this thread [Solved] and if you feel like it click Yes you found this helpful at the bottom right.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
startup script tractng Red Hat 3 07-15-2008 08:50 PM
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 02:53 AM
How to call a script from a system startup script? jonatito Linux - Newbie 7 11-11-2005 09:40 PM
wi-fi startup script Nodren Linux - Wireless Networking 6 05-09-2005 08:56 AM
startup script djinniyah Linux - Newbie 2 09-18-2003 05:07 AM


All times are GMT -5. The time now is 10:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration