Visit The New, Modern Unix Linux Community


Trying to make a script to run 3 other scripts in a screen.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Trying to make a script to run 3 other scripts in a screen.
# 1  
Trying to make a script to run 3 other scripts in a screen.

Hello, my name is Spurkle. I'm new to linux stuff.

Currently I am trying to make a script which will run three other scripts in screen.

This is the code:
Code:
sudo screen -S hubServ /var/servers/hub/hub.sh
sudo screen -S facServh /var/servers/factions/factions.sh
sudo screen -S bunServ /var/servers/bungeecord/bungeecord.sh

And this is what these scripts contain:
Code:
java -Xmx768M -Xms768M -jar bukkit.jar nogui


But when i try to run the launch.sh script (The one which should start 3 other scripts) i get this:

Code:
Cannot exec '/var/servers/factions/factions.sh': Permission denied
Cannot exec '/var/servers/hub/hub.sh': Permission denied
Cannot exec '/var/servers/bungeecord/bungeecord.sh': Permission denied

I tried giving all the files chmod 777, but it does not seem to work.


Any help would be appreciated.

Best regards,
Spurkle.
# 2  
Strange if you can run the scripts interactively without a problem. Still you need to make sure the entire directory path is executeable as well.
# 3  
Please run
Code:
ls -ld /var/servers
ls -ld /var/servers/hub
ls -ld /var/servers/hub/hub.sh

Permissions should be 755 (not 777 that is unsafe)
# 4  
Quote:
Originally Posted by MadeInGermany
Please run
Code:
ls -ld /var/servers
ls -ld /var/servers/hub
ls -ld /var/servers/hub/hub.sh

Permissions should be 755 (not 777 that is unsafe)
This is what i got:
Code:
root@CrimeCentral:~# ls -ld /var/servers
drwxrwxrwx 5 ftpadmin root 4096 Dec 18 13:24 /var/servers


root@CrimeCentral:~# ls -ld /var/servers/hub
drwxrwxrwx 9 ftpadmin root 4096 Dec 21 07:50 /var/servers/hub


root@CrimeCentral:~# ls -ld /var/servers/hub/hub.sh
-rwxrwxrwx 1 ftpadmin ftpadmin 45 Dec 21 07:50 /var/servers/hub/hub.sh

# 5  
I think the problem is here:
Quote:
Originally Posted by Spurkle
Code:
sudo screen -S hubServ /var/servers/hub/hub.sh
sudo screen -S facServh /var/servers/factions/factions.sh
sudo screen -S bunServ /var/servers/bungeecord/bungeecord.sh

You see, running a command through "sudo" means it is not executed as your user but as some other user. Which one that is (most times it is "root", but that doesn't have to be so) can be found out only by inspecting the file /etc/sudoers. Have a look at it with "view", "more" or something similar (it is safe to view it but under no circumstances change it!).

As the scripts are executable for everybody already you might consider dumping the "sudo" altogether and just run

Code:
screen -S hubServ /var/servers/hub/hub.sh
screen -S facServh /var/servers/factions/factions.sh
screen -S bunServ /var/servers/bungeecord/bungeecord.sh

instead.

I hope this helps.

bakunin
# 6  
Quote:
Originally Posted by bakunin
I think the problem is here:


You see, running a command through "sudo" means it is not executed as your user but as some other user. Which one that is (most times it is "root", but that doesn't have to be so) can be found out only by inspecting the file /etc/sudoers. Have a look at it with "view", "more" or something similar (it is safe to view it but under no circumstances change it!).

As the scripts are executable for everybody already you might consider dumping the "sudo" altogether and just run

Code:
screen -S hubServ /var/servers/hub/hub.sh
screen -S facServh /var/servers/factions/factions.sh
screen -S bunServ /var/servers/bungeecord/bungeecord.sh

instead.

I hope this helps.

bakunin
Hello, i tried running it as you said, but i still get the permissions error.

Image

Best regards,
Spurkle.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #493
Difficulty: Medium
When a program executes, each command executes one after the other, top-to-bottom. This is known as inconsequential control flow.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help to make script run recursively

I have this little bash script I use to transcode mkv files using handbrake. #!/bin/bash sourcedir="/media/raid10/video/to_be_encoded_series" destdir="/media/raid10/video/series" cd "$sourcedir" for i in *.mkv; do HandBrakeCLI -i "$i" -o "$destdir/${i%.*}.mkv" -e x264 -q 20.0 -E copy -B... (4 Replies)
Discussion started by: barrydocks
4 Replies

2. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

3. Shell Programming and Scripting

how we can make shell script not to run

Hi,shell script is scheduled from maestro and we want mastero should not run shell script so can we edit the shell script so that it should run.ThanksPrakash (5 Replies)
Discussion started by: prakashdba2010
5 Replies

4. Shell Programming and Scripting

Run a bash script, display on the screen and save all information in a file including error info

Hi all, How to: Run a bash script, display on the screen and save all information in a file including error information. For example: I have a bash script called test.sh now I want to run the test.sh and display the output on the screen and save the output including error info to a file. ... (1 Reply)
Discussion started by: Damon sine
1 Replies

5. UNIX for Advanced & Expert Users

How to make the variables of one script available for the other scripts?

Hello Everyone, I want to know how can we make the variables of one script available for the other script? for example i have three scripts variable_availability.sh,first.sh,second.sh and a file containing variables called common ---------------------------------- cat variable_availability.sh... (2 Replies)
Discussion started by: Kesavan
2 Replies

6. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

Good morning. I am searching for "how-to"'s for some particular questions: 1. How to write a script in HP-UX 11. 2. How to schedule a script. 3. How to "call" scripts from the original script. 4. How to su to another user from within a script. This is the basics of what the... (15 Replies)
Discussion started by: instant000
15 Replies

7. Shell Programming and Scripting

script that reads all the scripts in the directory and run them within that script

Hi I am trying to write a shell script that is reading all the scripts in the current directory (currently 5) and is allowing me to run the scripts that is in the directory. I want that this scripts asks te user to execute 1 of the listed scripts. I have 4 sample scripts in the directory:... (8 Replies)
Discussion started by: I-1
8 Replies

8. UNIX for Dummies Questions & Answers

help to make list of files and run script..

Hey, I have finally made a command that works and now has to run it on 200+ files to run it on. How do I do that? Just fyi and if it complicates anything my commandline is: awk '{if ($1 ~ /1/) print $2}' file (yup, is should print $2 if $1 is a certain value) It doesn't work when I: ... (2 Replies)
Discussion started by: lost
2 Replies

9. Shell Programming and Scripting

Can anyone make this script run faster?

One of our servers runs Solaris 8 and does not have "ls -lh" as a valid command. I wrote the following script to make the ls output easier to read and emulate "ls -lh" functionality. The script works, but it is slow when executed on a directory that contains a large number of files. Can anyone make... (10 Replies)
Discussion started by: shew01
10 Replies

10. Shell Programming and Scripting

Run scripts within a script..

Hi all... I have several scripts of varying types (shell script, expect script, awk script) that I would like to run within 1 script.. They also take a command line argument (which it is getting successfully). The problem is, the parent script is exiting after the first script it calls is... (2 Replies)
Discussion started by: earnstaf
2 Replies

Featured Tech Videos