a problem with write a script in Linux version 2.4.27-ubnt0


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers a problem with write a script in Linux version 2.4.27-ubnt0
# 1  
Old 11-14-2010
a problem with write a script in Linux version 2.4.27-ubnt0

Hello everyone,
I have a radio wireless called UBNT Nanostation5
It has this linux OS:Linux version 2.4.27-ubnt0

When i want to write a script in ssh, i get some errors
The script is:

Code:
ifconfig eth0 down

ifconfig eth0 hw ether 00:15:6D:**:**:**

ifconfig eth0 up

cfg -x

echo "ifconfig br0 down; ifconfig wifi0 down; ifconfig wifi0 hw ether 00:15:6D:**:**:**; ifconfig wifi0 up; ifconfig br0 up" > /etc/persistent/rc.prestart

cfgmtd -w -p /etc/

reboot

And errors that i get are:

Code:
# ifconfig eth0 down

ifconfig eth0 hw ether 00:15:6D:**:**:**

ifconfig eth0 up

cfg -x

echo "ifconfig br0 down; ifconfig wifi0 down; ifconfig wifi0 hw ether 00:15:6D:**:**:**; ifconfig wifi0 up; ifconfig br0 up" > /etc/persistent/rc.prestart

cfgmtd -w -p /etc/
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939# ifconfig eth0 hw ether 00:15:6D:1A:74:1D
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939# ifconfig eth0 up
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939# cfg -x
-sh: cfg: not found
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939# echo "ifconfig br0 down; ifconfig wifi0 down                           ; ifconfig wifi0 hw ether 00:15:6D:**:**:**; ifconfig wifi0 up; ifconfig br0 up"                            > /etc/persistent/rc.prestart
-sh: gt: not found
-sh: /etc/persistent/rc.prestart: not found
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939#
XS5.ar2313.v3.5.1.4631.300610.1939# cfgmtd -w -p /etc/
ifconfig br0 down; ifconfig wifi0 down; ifconfig wifi0 hw ether 00:15:6D:**:**:**; ifconfig wifi0 up; ifconfig br0 up
Found Backup1 on[1] ...
Found  Active on[2] ...
Storing Active[1] ... [%100]
Active->Backup[2] ... [%100]
[1] + Done                       echo "ifconfig br0 down; ifconfig wifi0 down; i                           fconfig wifi0 hw ether 00:15:6D:**:**:**; ifconfig wifi0 up; ifconfig br0 up"
XS5.ar2313.v3.5.1.4631.300610.1939#

why do i receive these "not found" errors?

thanks
# 2  
Old 11-14-2010
I suspect you did not show us all the files, but it sound like you forgot that in the form
Code:
ssh user@host cmd

the command runs with a default shell and $PATH. Do an
Code:
ssh user@host 'ps -fp $$ ; echo $PATH'

to see what shell is active, and if you need to provide more path for cmd.

Else, do something to set environment like
Code:
ssh user@host '. ./.profile ; cmd'

BTW, to improve speed when doing more than one thing remotely, something like this works well, and you can preview your generated script locally with ease and accuracy:
Code:
(
  scripting-to-generate-all-setup-and commands
 ) | ssh user@host ksh

This User Gave Thanks to DGPickett For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Write Linux script to convert timestamps older than 1.1.1970 to 1.1.1980

I am having problems because some of my files have timestamps that are earlier that 1.1.1970, the Unix start of time convention. So I would like to write a script that finds all files in home folder and subfolders with timestamps earlier than 1.1.1970 and converts them to 1.1.1980. I... (3 Replies)
Discussion started by: francus
3 Replies

2. Shell Programming and Scripting

Setuid not working in Linux as script fails to write to file.

Hi, I have the following 3 test files to test setuid bit which if it works I would like to implement in our application. However setuid doesnot seem to be having any impact on my test below.Following are the 3 files of interest in /tmp/ folder. $ ls -ltr *env* -rw------- 1 g332008 users 6... (23 Replies)
Discussion started by: waavman
23 Replies

3. Shell Programming and Scripting

How to write bash script for creating user on multiple Linux hosts?

I wonder whether someone can help me with what I'm trying to achieve Basically, the objective is one script to create new user on more than 70 linux hosts if required. Everything works apart from the highlighted part. It gave me an output passwd: Unknown user name ''. when try to set... (35 Replies)
Discussion started by: fugeulu
35 Replies

4. Linux

Linux Version of IE?

Is there a linux version of IE? (5 Replies)
Discussion started by: billcrosby
5 Replies

5. Shell Programming and Scripting

Write a shell script security policy settings for linux

The pro help! Write a shell script setup for linux security policies include: 1. login (username and password login). 2. add, delete your username and password. 3. firewall. Note: Write a shell script file as follows: If login successful then Step 2. If step 2 succeeds (ie add,... (1 Reply)
Discussion started by: ngovuongbinhtay
1 Replies

6. Linux

How to know the Linux version?

Hi, How to know the Linux version in the box in which linux is installed ? Cheers K Md Shakeel (3 Replies)
Discussion started by: krackjack
3 Replies

7. Linux

Why is there so many linux version?

Hi, Why is there many different Linux names and SO instead to be only one? What are the differences? Paul Weinstock (3 Replies)
Discussion started by: Paul Weinstock
3 Replies

8. UNIX for Dummies Questions & Answers

How do I see which version of Linux I am using ?

I want to know the distribution and version of linux that I am running: uname -r gives me: 2.4.20-8bldsmp uname -v gives me: #1 SMP Wed Sep 20 19:32:24 PDT 2006 Whats the distribution ? and whats the version ? thanks !!! (1 Reply)
Discussion started by: the_learner
1 Replies

9. UNIX for Dummies Questions & Answers

How to write my own version of pthread_join()

I would like to write my own version of pthread_join and some of the other pthread function. Does some know any pages that have som examples of doing this?? (1 Reply)
Discussion started by: bigblop
1 Replies

10. UNIX for Dummies Questions & Answers

Need to write a home-grown backup script for Linux

I am researching ways in which to backup files or whole file systems for backup to another system. We are using Suse Linux 7.0 with no tape backup devices or secondary disks. What utilities would be the best to use for a simple yet flexible script for backup purposes? tar, cpio, compress. (3 Replies)
Discussion started by: darthur
3 Replies
Login or Register to Ask a Question