Solved

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

Posted on 2016-08-23
5
134 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
 
LVL 1

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
 
LVL 1

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
 
LVL 1

Author Closing Comment

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

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

630 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