Using FTP to execute command line commands remotely
I know nuts about unix programming so pls dun laugh ur head off or tear off ur hairs at my questions. :)
Pls have a look at my Bourne Shell Script:
ftp remotehost << StartOfFtp
user root root
There are two remote folders path (/opt/user & /data) which I will access and both contains data files (.log). /data folder will continuously add in new .log files. So what this section will do is to compare the data files in /data folder with the data files in the /opt/user. For data files that exists in /opt/user will not be copied over while data files that does not exists in /opt/user will be copied over and renamed (What I mean the filename will be appended adding a LBS_ in the front). Then I will then ftp the data files which does not exists in /opt/user to the local folder path /tomcat/webapps/chart/data
ls >> /result
su user << StartUser
1) Is my coding correct so far? ok exclude the /* */(Sorry I am now learning java so pls excuse me)
2)I am stuck as how to continue the section explained in the /* */. Can anyone give me an example script and an explaination? I am really at my wits end and is starting to tear my hair apart trying to search for examples in the google.
The Solaris FTP server doesn't allow access to su, crontab or most other commands. Connect with the client and issue the help command to see what is available. You're probably better off going SSH route for this type of stuff.
Ok stickman thank you for your advice guess have to see again what SSH has to offer...............
One last question what is the ftp "exec" command does? I am sorry but I just can't understand what it means......... Can anyone care to explain it to me in plain english pls?
Solaris and Java Newbie
exec is shell command that allows you to replace the current shell with another shell or comman. For example, if your normal default login shell in Solaris is sh, but you want to run ksh, you could do either of these commands to get to ksh:
The first will run ksh "on top of" your current sh. It will take two exits to logout.
The second will replace your sh with a ksh. It will take one exit to logout.
You also see this when working with window manager where the last line of the script is an exec statement. This will replace the shell with the window manager, and when the manager is exited the user is also logged out. exec also works in Linux.
|All times are GMT -5. The time now is 03:34 AM.|