cron command
hi there....not just a new newbie...but a total newbie:)
i am trying to set a cron job on my web server, i know the format is in unix style i have an ftp account that i want my webserver to access and then once accessed to simply delete a specific file i know how to get the cron to contact the remote machine..i think lets say the username is mike and the password is mike for the remote ftp account some thing like this isnt it? Code:
ftp://mike:mike@2##.1##.92.1##:21 i know the command for deleting a remote file is simply "delete". but i do not know who to structure the command. Any help would be appreciated |
If you have ssh enabled, your probably better off creating a quick script to remove the file by using ssh keys so you don't have to pass a password to the server.
Create the script: Code:
#!/bin/bash Then just add this to your crontab (the example would run at 2:20 AM daily): Code:
20 2 * * * /path/to/script/created/above 1> /dev/null |
Re: cron command
this should take care of it for you...
(NOTE: i am using your example so change it accordingly ;)) create ~/.netrc and change its permissions to rw only by you chmod 600 ~/.netrc if it does not already exist, otherwise just add the following anywhere in the file as long as it is above any 'default' line you have in .netrc place this line Code:
machine 2##.1##.82.1## login mike password mike example script (script_name): Code:
#!/bin/bash confirm that it works from cli first. if it works when invoked from cli (./script_name) but not from cron then add . /etc/bashrc above the 'ftp << EOF' line and try again hope this helps [EDIT: i would agree with trickykid on using ssh if possible] |
All times are GMT -5. The time now is 07:21 PM. |