Linux - GeneralThis forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am ftping from a linux server to a Windows server running Serv-U Ftp server, and the Serv-U server is set to Active Mode ftp. I have a script that ftps at night from the Redhat server. If I run the script at night in a cron, I get "passive mode not allowed on this server" errors and the files don't transfer. If I execute the same script manually, I don't get the error and the files transfer.
Any suggestions why and is there a command script to run it actively and successivly.
cron is not a standard shell. Many things that will work OK at the command line don't in cron because of this difference. The main reason this occurs is that cron doesn't inherit an environment so some things you don't think about (such as $PATH) may not be defined.
type "echo $PATH" and you'll the paths that are searched when looking for executables. Without this variable even simple commands such as "ls" wouldn't work because it wouldn't know where to find them.
Often for cron scripts you need to insert a PATH variable into the script or just hard code the full path to commands. So if your script now contains "ls" you would need to change it to "/bin/ls". You need to do this for each command used in the script or alternatively set PATH=/bin:/usr/bin: (etc...) so that it knows where to find each of your commands.
And of course PATH is just one of many possible variables. You need to make sure you know what your script is relying on - there may be a config file you need to source.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.