1834206 Members
2246 Online
110066 Solutions
New Discussion

Script to stop Apps

 
Eric Jacklin
Regular Advisor

Script to stop Apps

Hi team,

Here i would like to add below mention two commands in a .sh script so that i can run the same from my backup

From root prompt i am using below mention commands

#cd /sbin/rc3.d
#./S910ixos stop

11 REPLIES 11
OldSchool
Honored Contributor

Re: Script to stop Apps

Well, I'm not sure exactly what, if anything you're asking, but:

yes you can put that in a script to stop that app before backup. Or

/sbin/rc3.d/S910ixos stop (one-liner) Note that you're running the "Start" link. It'll work, just a matter of style.

or

/sbin/rc2.d/K090ixos stop (or similar) should be in the rc2.d directory. Thats the "Kill" link. as noted above.

or I prefer running the script the links above point to. do an "ls -l /sbin/rc2.d/S910ixos" and see what the link points to and run that directly. something like "/sbin/init.d/ixos stop"



Eric Jacklin
Regular Advisor

Re: Script to stop Apps

Hi

I have include oneline command in .sh script but it is not working.

Any further help or i am doing something wrong ?



# ls -ltr
total 2
-rwxrwxrwx 1 root sys 25 Nov 16 21:06 stopixos.sh
# more stopixos.sh
sbin/rc3.d/S910ixos stop
# stopixos.sh
sh: stopixos.sh: not found.
#
David Bellamy
Respected Contributor

Re: Script to stop Apps

Try running as ./stopixos.sh. its not found because its not in your path
A. Clay Stephenson
Acclaimed Contributor

Re: Script to stop Apps

The bad news is that someone who lacks knowledge of such a simple concept as PATH'ing in UNIX has absolutely no business running as a super-user. You could destroy a system quite by accident in your present state --- so start learning (and do it as a regular user).
If it ain't broke, I can fix that.
Eric Jacklin
Regular Advisor

Re: Script to stop Apps

# id
uid=0(root) gid=3(sys) groups=0(root),1(other),2(bin),4(adm),5(daemon),6(mail),7(lp),20(users)
# ls -ltr
total 2
-rwxrwxrwx 1 root sys 25 Nov 16 21:06 stopixos.sh
# ./stopixos.sh
./stopixos.sh: sbin/rc3.d/S910ixos: not found.
# more stopixos.sh
sbin/rc3.d/S910ixos stop
Eric Jacklin
Regular Advisor

Re: Script to stop Apps

Still facing the same problem check the above message.
spex
Honored Contributor

Re: Script to stop Apps

> # more stopixos.sh
> sbin/rc3.d/S910ixos stop

You are missing the initial '/' in the absolute path. The command should read:

/sbin/rc3.d/S910ixos stop

However, you should be calling the script S910ixos is symlinked to. Most likely:

/sbin/init.d/ixos stop

PCS

OldSchool
Honored Contributor

Re: Script to stop Apps

hint...

can *YOU* find "sbin/rc3.d/S910ixos"?

do you know why you can (or can't) find that file?

another little hint....relative or absolute path?

these are things that make systems go *boom*

Eric Jacklin
Regular Advisor

Re: Script to stop Apps

Lot of Hints but no solution.if somebody who is having expertise skill in unix why he will come to forums.
OldSchool
Honored Contributor

Re: Script to stop Apps

"Lot of Hints but no solution.if somebody who is having expertise skill in unix why he will come to forums"

Actually, you were given the correct and complete answer at least once.

the issue lies in the difference between
/sbin
and
sbin

as noted above.
Dennis Handly
Acclaimed Contributor

Re: Script to stop Apps

>I would like to add below mention two commands in a .sh script so that I can run the same from my backup
#cd /sbin/rc3.d
#./S910ixos stop

You should use an absolute path, not two commands. Otherwise the cd may cause junk to accumulate in that directory.

Your script should also start with an interpreter and if you don't know if all file systems are mounted, use:
#!/sbin/sh