Solved

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

Posted on 2016-08-23
5
112 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
 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
installing LSI MegaRAID Storage Manager on CentOS 7 22 707
wipe a usb using python 5 64
Ubuntu Apache Webserver - File Permissions 5 58
php56-php-mcrypt for rhel7 php56 1 43
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

809 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