LinuxQuestions.org
Visit Jeremy's Blog.
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 04-16-2015, 10:14 PM   #1
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Rep: Reputation: 3
Path to my script


Stupid question, i know, but what is the correct path to run a script from root that is located in /home?
screen -dmS bungee /home/sh bungeestart.sh >> /home/spigot.out
I have this but is doesn't work....
This is done via crontab at reboot...

Last edited by EODSteven; 04-16-2015 at 10:19 PM.
 
Old 04-16-2015, 10:42 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,169

Rep: Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493Reputation: 2493
if you ARE root and runing the script as root
the root home folder is well
/root

do you want it ran on boot ?
or on login of a particular user

for something system wide
place the shell script in
/etc/profile.d/

for a particular user
for the KDE desktop
/home/TheUsersHomeFolder/.kde4/Autostart/

or add it to the " .bashrc" or " .profile "
 
Old 04-16-2015, 10:48 PM   #3
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
I can't just specify at reboot to run the script located in /home at reboot?
I guess i can move the script to the root folder but that doesn't seem optimal.

Last edited by EODSteven; 04-16-2015 at 10:49 PM.
 
Old 04-16-2015, 11:00 PM   #4
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
That worked just fine but it just seems weird putting files in the root directory. Is there not a path to home I could have typed? btw, it runs at boot created by typing crontab -e at the root login, Its a dedicated server.

Last edited by EODSteven; 04-16-2015 at 11:02 PM.
 
Old 04-16-2015, 11:03 PM   #5
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
screen -dmS bungee /home/sh bungeestart.sh >> /home/spigot.out
Should not it be:

Code:
screen -dmS bungee /bin/sh bungeestart.sh >> /home/spigot.out
 
Old 04-16-2015, 11:17 PM   #6
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by veerain View Post
Should not it be:

Code:
screen -dmS bungee /bin/sh bungeestart.sh >> /home/spigot.out
Yea, trying to figure it out...the script is not located in /bin its located in /home....Thats always confused me about Linux directory structure If i do cd /bin, nothing is in there so how can you run a file from where it doesn't exist? Is there some kind of symbolic link between the /home i created and /bin? This is a dedicated server and never had the normal /home of the user login like in a standard installation, I just created /home to be like I'm accustom to in a normal server setup.

The scripts that crontab runs are in the root directory and they run fine, but it does not seem like good practice to do this...Opinions?

Last edited by EODSteven; 04-16-2015 at 11:26 PM.
 
Old 04-17-2015, 12:18 AM   #7
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
The scripts that crontab runs are in the root directory and they run fine, but it does not seem like good practice to do this...Opinions?
Well for desktop setup it is not good. But for server setup each user would have his own copy of system files for isolation.
 
1 members found this post helpful.
Old 04-17-2015, 01:18 AM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,358
Blog Entries: 55

Rep: Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545Reputation: 3545
Quote:
Originally Posted by EODSteven View Post
(..) the script is not located in /bin its located in /home....Thats always confused me about Linux directory structure If i do cd /bin, nothing is in there so how can you run a file from where it doesn't exist? Is there some kind of symbolic link between the /home i created and /bin? This is a dedicated server and never had the normal /home of the user login like in a standard installation, I just created /home to be like I'm accustom to in a normal server setup.
Maybe you should detail precisely what kind of "server" account you have? I mean this isn't your personal dedicated server, right?


Quote:
Originally Posted by EODSteven View Post
The scripts that crontab runs are in the root directory and they run fine, but it does not seem like good practice to do this...Opinions?
Indeed it isn't and this shouldn't need to be this way. See if, in your unprivileged users crontab, you can use a "@reboot" line to start Bungee. Also, since you're running Minecraft please see http://www.theregister.co.uk/2015/04...craft_servers/
 
1 members found this post helpful.
Old 04-17-2015, 01:27 AM   #9
cheap freelancer
LQ Newbie
 
Registered: Jun 2007
Location: buybook.in
Distribution: redhat
Posts: 6

Rep: Reputation: 0
I guess you need to add an &.
 
Old 04-17-2015, 04:17 AM   #10
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by unSpawn View Post
Maybe you should detail precisely what kind of "server" account you have? I mean this isn't your personal dedicated server, right?



Indeed it isn't and this shouldn't need to be this way. See if, in your unprivileged users crontab, you can use a "@reboot" line to start Bungee. Also, since you're running Minecraft please see http://www.theregister.co.uk/2015/04...craft_servers/
No, this is not my own personal server, I rent it from Namecheap, Operating system is Ubuntu Server, 14.04. I have not, (fixn to learn how) even set up a "unprivileged" account. All I can do at the moment is log in through terminal ssh @root and use Filezilla to transfer files. Thanks for that article, I will forward it to the developer, MD_5, of my particular server software which is called Spigot.

I have been told that exploit has been patched...."For security reasons it is recommended that all users upgrade to Minecraft 1.8.3 by re-running BuildTools. A fix for 1.8 is also available via the --rev 1.8 argument. At this stage there is no fix for 1.7.10 or below, however given these builds have been unsupported for more than 7 months, we recommend that all servers look into upgrading. For those using Vanilla, it is anticipated a fixed 1.8.4 version will be released by Mojang soon."

Last edited by EODSteven; 04-17-2015 at 04:26 AM.
 
Old 04-17-2015, 04:59 AM   #11
EODSteven
Member
 
Registered: Oct 2012
Location: Manchester, Tn
Distribution: Ubuntu 14.04, Windows 8, Windows Server 2012. Ubuntu Server 14.04
Posts: 196

Original Poster
Rep: Reputation: 3
The question led to the answer! Once I created my unprivileged user it all made sense and why the path wasn't working. Thanks! By the Way, to anyone reading this, in Ubuntu it is adduser not useradd, learned this by trial and error.

Last edited by EODSteven; 04-17-2015 at 05:00 AM.
 
  


Reply

Tags
crontab, script


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
script to read path from console and used to change the script execution path vdamgo Linux - General 5 02-12-2013 02:18 PM
Passing a path to a gnuplot script from bash script mystupidquestion Programming 2 10-11-2011 09:10 AM
How to get full path to script file inside script itself? And in case of sym links? maggus Linux - Newbie 3 05-28-2009 08:40 AM
bash script path issue - how to pass a path as a string to a variable PiNPOiNT Programming 5 04-17-2009 05:48 PM
script to change unix path to windows path in all files csross Programming 8 04-29-2006 01:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:52 PM.

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