LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   CD Path and Execute New Process - Shell (https://www.linuxquestions.org/questions/linux-newbie-8/cd-path-and-execute-new-process-shell-4175434144/)

TheSmallRock 10-26-2012 01:42 AM

CD Path and Execute New Process - Shell
 
Hello,

I'm working an a game control panel for SA-MP.
For start I wanna do a START and a STOP button using shell script.

Code:

#! /bin/bash

cd /var/zpanel/hostdata/****/samp/RolePlay/

nohup ./samp03svr &

This code works on terminal . But when I use it in a .sh file I get this error :

Quote:

sh ./start.sh
: not found 2:
cd: 3: can't cd to /var/zpanel/hostdata/*****/samp/RolePlay/
: not found 4:
nohup: appending output to `nohup.out'
nohup: failed to run command `./samp03svr': No such file or directory
root@server1:/var/zpanel/hostdata/*****/public_html/leading-fun_com/game#
What I'm doing wrong ?

Thanks .

chrism01 10-26-2012 04:53 AM

Can you show us the script code, those errors don't seem to match the above code.
I also recommend adding the debug cmd set -xv thus
Code:

#!/bin/bash
set -xv

cd /var/zpanel/hostdata/****/samp/RolePlay/

nohup ./samp03svr &

Incidentally, note that there should be NO spaces in the '#!/bin/bash' cmd.

TheSmallRock 10-26-2012 09:12 AM

That was the code I used ...
---

I don't get errors anymore . but it's not starting the server.

I use this script to kill samp03svr :

Code:

lsof|grep /var/zpanel/hostdata/********/samp/FunPlay/| awk '{print $2}'|xargs kill
Is good because kills only the wanted app but when I wanna start it with :

Code:

#!/bin/bash
set -xv

cd /var/zpanel/hostdata/*****/samp/RolePlay/

nohup ./samp03svr &

(Your code) nothing happens.


All times are GMT -5. The time now is 11:51 PM.