Solved

How to run a Linux Command from a different other than Root in Linux

Posted on 2016-08-23
5
80 Views
Last Modified: 2016-08-25
Hello Experts,

I would like to run the following script from a directory other than root:

./wrapper-linux -m ./i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2001 -- 1 > /dev/null 2>&1 & sleep 5

I would like to run this script in Linux from a directory called LAN, so tried

./LAN ./wrapper-linux -m ./i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2001 -- 1 > /dev/null 2>&1 & sleep 5

The only way to run the script is go enter the directory where the wrapper-linux file is (LAN) and run it from there.

Any thoughts?

Cheers

Carlton
0
Comment
Question by:Member_2_7966113
  • 3
5 Comments
 
LVL 61

Expert Comment

by:gheist
ID: 41766901
(cd directory ; ./wrapper bin ) &
0
 

Author Comment

by:Member_2_7966113
ID: 41766921
Thanks for responding. I'm a complete novice to Linux, (never had to use it before). Attached is the script that I'm trying to run from a directory called Are you suggesting that I simply add CD; ./wrapper-linux -m ./i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2001 -- 1 > /dev/null 2>&1 & sleep 5 to script?
ROUTE
0
 

Author Comment

by:Member_2_7966113
ID: 41766944
Sorry I meant simply add:
CD; LAN  ./wrapper-linux -m ./i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2001 -- 1 > /dev/null 2>&1 & sleep 5  to the end of the script?
0
 
LVL 37

Accepted Solution

by:
Gerwin Jansen earned 500 total points
ID: 41767442
#!/bin/bash
#
cd /LAN
../wrapper-linux -m ../i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2001 -- 1 > /dev/null 2>&1 &
sleep 5
../wrapper-linux -m ../i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2002 -- 2 > /dev/null 2>&1 &
sleep 5
../wrapper-linux -m ../i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2003 -- 3 > /dev/null 2>&1 &
sleep 5
../wrapper-linux -m ../i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2006 -- 6 > /dev/null 2>&1 &
sleep 5
../wrapper-linux -m ../i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2007 -- 7 > /dev/null 2>&1 &
sleep 5
../wrapper-linux -m ../i86bi-linux-l3-adventerprisek9-15.4.1T.bin -p 2008 -- 8 > /dev/null 2>&1 &
sleep 5
echo ""
echo "--------------------------------------------"
echo " LAB Routers started! -- by http://flyxj.cn "
echo "--------------------------------------------"
echo ""

Open in new window


or if you mean ./LAN then change that line #3 to:

cd ./LAN
0
 

Author Closing Comment

by:Member_2_7966113
ID: 41770008
Thanks Gerwin, this seemed to fix the problem
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now