Need help operating the "vi" command remotely


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Need help operating the "vi" command remotely
# 1  
Old 06-11-2006
Need help operating the "vi" command remotely

i have a script that runs the below command on a remote box.

ssh root@$responsea ' echo " " ; echo " " ; echo " " ; df -kl ; sleep 3 ; /apps/scripts/deleter ; vi /apps/scripts/deleter '

now, if the command above doesn't work like it should be. the user needs to edit a file on the remote host.

however, everytime i add vi to the end of the sequence of commands to run i get a error that says something like:

Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

does anyone know how to deal with this so the user can effectively edit using vi on the remote host?
Terrible
# 2  
Old 06-11-2006
I'd have to point out it is definitely not a good idea to allow a user to vi anything as root, especially a script executable as root. May as well change the name of the script to "hackme" or "hoseme".

What type of changes are you talking about? Is it really necessary that a human do the actual editing? What exactly are you trying to accomplish with the editing?
I take it that you want the user to look at the output of df -kl, and then make a decision on what needs to be purged, then edit the deleter accordingly so it can delete whatver needs to be deleted to free some space?
# 3  
Old 06-12-2006
Quote:
Originally Posted by System Shock
I'd have to point out it is definitely not a good idea to allow a user to vi anything as root, especially a script executable as root. May as well change the name of the script to "hackme" or "hoseme".

What type of changes are you talking about? Is it really necessary that a human do the actual editing? What exactly are you trying to accomplish with the editing?
I take it that you want the user to look at the output of df -kl, and then make a decision on what needs to be purged, then edit the deleter accordingly so it can delete whatver needs to be deleted to free some space?


yes. usually the script will automatically run without user intervention. however, sometimes it doesn't because there aren't files to delete that are older than the threshold number given in the file.

so if the script doesn't work because of that i want the user to be able to go in and lower the number and keep lowering it till the script recognizes and deletes the files matching the threshold given.
Terrible
# 4  
Old 06-12-2006
Ok.
Why don't you edit the script to first check and see if there are any files to delete and If there aren't any files that match the original criteria, have the script check for newer files? You can loop this until a) you delete files and free space or b) you get to a point where you can't delete anything and get a notification.

There's absolutely no need to have a person plug in dates.
# 5  
Old 06-13-2006
Quote:
Originally Posted by System Shock
Ok.
Why don't you edit the script to first check and see if there are any files to delete and If there aren't any files that match the original criteria, have the script check for newer files? You can loop this until a) you delete files and free space or b) you get to a point where you can't delete anything and get a notification.

There's absolutely no need to have a person plug in dates.

smart idea. thanks. Smilie
Terrible
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. AIX

[Tip] Problem with rpm ("different operating system")

I have once experienced this problem without understanding what caused it but now learned thatn there is even a PMR dealing with it. Sometimes it happens that you encounter the following (rather cryptical) error message when trying to install an rpm-package: package <rpm_package_name> is for a... (1 Reply)
Discussion started by: bakunin
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Solaris

Solaris Operating Environment Installation CD, aka "CD0" PN: 704-7076-10

Hi to all. It is need to install Solaris 2.5.1 on Sun Enterprise 220r and 420r. Share somebody Solaris Operating Environment Installation CD, aka "CD0" PN: 704-7076-10 ... It is very necessary! ! ! PM or ftp link.... :D (4 Replies)
Discussion started by: aivengoff
4 Replies

5. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

8. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

9. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

10. UNIX for Advanced & Expert Users

How to control remotely "full" Linux router in GUI ?

Hi, I mean Unix Linux general solution, so please don't move my question, as it's Unix specific. I would like to remotely control my "full" Linux router. Already succeeded to compile Linux Unix dialog, running some tests. The issue is dialog comes with a limited number of widget boxes for... (4 Replies)
Discussion started by: jack2
4 Replies
Login or Register to Ask a Question