Results 1 to 6 of 6

Thread: How to use gpg + cron?

  1. #1
    Join Date
    Oct 2006
    Beans
    Hidden!

    How to use gpg + cron?

    Hello, I have this script:

    #!/bin/bash

    ## cifro un fichero
    /usr/bin/gpg --encrypt --batch --no-tty --yes --recipient Mypubkey /home/joseba/salida.txt > /home/joseba/logcronjob.txt
    #EOF

    If I use the line

    joseba@server$ /usr/bin/gpg --encrypt --batch --no-tty --yes --recipient Mypubkey /home/joseba/salida.txt > /home/joseba/logcronjob.txt

    I dont have problems, salida.txt has encrypted

    But by crontab -e (for user joseba) dont work and dont encrypt nothing
    If I use 'sudo crontab -e' same result, dont work

    Mypubkey exists

    On logcronjob.txt nothing, 0 bytes

    I think env its ok for the users


    Any idea please?


    Sorry for my english!
    Juanjo A.

  2. #2
    Join Date
    Jul 2009
    Location
    London
    Beans
    1,480
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: How to use gpg + cron?

    I don't know, but would suggest you capture stderr output in addition to stdout to see if any errors are being output.
    so change the
    Code:
    > /home/joseba/logcronjob.txt
    to
    Code:
    &> /home/joseba/logcronjob.txt

  3. #3
    Join Date
    Oct 2006
    Beans
    Hidden!

    Re: How to use gpg + cron?

    Quote Originally Posted by DaithiF View Post
    I don't know, but would suggest you capture stderr output in addition to stdout to see if any errors are being output.
    so change the
    Code:
    > /home/joseba/logcronjob.txt
    to
    Code:
    &> /home/joseba/logcronjob.txt
    Ok but /home/joseba/logcronjob.txt = 0 bytes
    No error detected

    Thx.
    Juanjo A.

  4. #4
    Join Date
    Jul 2009
    Location
    London
    Beans
    1,480
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: How to use gpg + cron?

    works fine for me from cron and from command line. is you cron working ok, e.g. if you put in a simple job like this:
    Code:
    * * * * * echo "testing" > /home/joseba/crontest.out
    does it create the crontest file?

  5. #5
    Join Date
    Oct 2006
    Beans
    Hidden!

    Re: How to use gpg + cron?

    Quote Originally Posted by DaithiF View Post
    works fine for me from cron and from command line. is you cron working ok, e.g. if you put in a simple job like this:
    Code:
    * * * * * echo "testing" > /home/joseba/crontest.out
    does it create the crontest file?
    Yes, the script is more complex.
    The only part that does not work is the command gpg ...
    From command line the script is ok.

    Thx
    Juanjo A.

  6. #6
    Join Date
    Oct 2006
    Beans
    Hidden!

    Re: How to use gpg + cron?

    I think the problem is the key. In this example I use a key without Spanish characters (ñ, accents, ...) but in the real script, the key has accents.

    Un saludo
    Juanjo A.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •