Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2016-08-23
5
Medium Priority
?
152 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 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…
Suggested Courses

927 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