Solved

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

Posted on 2016-08-23
5
117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 62

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 38

Accepted Solution

by:
Gerwin Jansen, EE MVE 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

730 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