How to create a cron job to upload files to an FTP server

120

This is an FTP sample script to transfer one file: (Note you can use an FQDN instead of IP)

#!/bin/bash

# $1 is the file name for the you want to tranfer
# usage: this_script  <filename>
IP_address="xx.xxx.xx.xx"
username="remote_ftp_username"
domain = sample.domain.ftp
password= password

ftp -n > ftp_$$.log <<EOF
 verbose
 open $IP_address
 USER $username $password
 put $1
 bye
EOF

Add the > ftp_$$.log only if you need logging. Then you can use the

crontab -e

command to edit the cronjob table and add your script.

This is an Example:

If you liked to have a the script above, (assume you have it in home and its name is myscript.sh) /home/myscript.sh, run every day at 2am, you have to do:

# crontab -e

and then you have to add the following entry:

0 2 * * * /home/myscript.sh

As a reference, here you have a crontab entry parameters meaning:

* * * * * command to be executed
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

This tutorial could also help you.

Share:
120
brg
Author by

brg

Updated on September 18, 2022

Comments

  • brg
    brg over 1 year

    Though the "posts/index" template is rendering, the emberjs #each helper inside the template does not produce any output. this is the jsfiddle: http://jsfiddle.net/rxWzu/

    I have tried this:

    {{#each  post in content}}
     <p> {{post.title}} </p>
    <p>{{#linkTo 'posts.post' post}} {{post.body}}  {{/linkTo}}</p>
    {{/each}}
    

    and this

    {{#each controller}}
     <p>{{title}} </p>
     <p>{{#linkTo 'posts.post' post}} {{body}}  {{/linkTo}}</p>
    {{/each}}
    

    Thanks.

    • phildeutsch
      phildeutsch almost 14 years
      This should go on to superuser.com as this is not a programming related question.
  • brg
    brg over 11 years
    thanks @c4p for the answer. Is there a reason why the if /else block did not work, since the else block contained 'return EmBlog.Post.find();'
  • CraigTeegarden
    CraigTeegarden over 11 years
    Is .all() the correct method for a ember-data model? In the documentation (emberjs.com/guides/models/finding-models) it looks like you should use find() to get all objects from the model. Also, in your code the isLoaded was always returning true so the else was never executed.