LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices



Reply
 
Search this Thread
Old 02-10-2004, 02:56 AM   #1
steve_2010
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Rep: Reputation: 0
Unhappy Using FTP to execute command line commands remotely



Hi all!
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:

#!/sbin/sh

ftp remotehost << StartOfFtp
user root root
cd /opt/user
/*
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
StartOfFtp
su user << StartUser
user
crontab /opt/user/cronjob
exit
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.
 
Old 02-10-2004, 08:55 AM   #2
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
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.
 
Old 02-10-2004, 08:07 PM   #3
steve_2010
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Original Poster
Rep: Reputation: 0
Ok stickman thank you for your advice guess have to see again what SSH has to offer...............
 
Old 02-10-2004, 08:13 PM   #4
steve_2010
LQ Newbie
 
Registered: Jan 2004
Posts: 13

Original Poster
Rep: Reputation: 0
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?


Steve Tan
Solaris and Java Newbie
 
Old 02-13-2004, 09:44 AM   #5
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
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:

ksh
exec 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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 10:16 AM
PHP execute at command line gjmwalsh Mandriva 2 12-06-2003 02:03 AM
is there any linux command to download files from any ftp site remotely midnitc Linux - General 3 10-31-2003 09:05 AM
wu-ftp help with chroot - ls command does not execute bock Linux - Software 2 09-18-2002 02:47 PM
Can't execute ifconfig at command line jhsuan Linux - Newbie 3 08-30-2002 09:57 PM


All times are GMT -5. The time now is 06:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration