Dave wrote:
"[EMAIL PROTECTED] /etc/cron.daily/daily_apt-get -v
/etc/cron.daily/daily_apt-get: line 11: upgrade: command not found
apt 0.5.28.4 for linux i386 compiled on Feb 11 2005 08:15:54
Usage: apt-get [options] command
       apt-get [options] install|remove pkg1 [pkg2 ...]
       apt-get [options] source pkg1 [pkg2 ...]                   ..."

On line 11 I presume is the initial definition of MYSCRIPT. You must not have the space after the = sign.


Also, you should not include the command-line options at this point, because that messes up the test ([ !-x) and possibly the invocation. The shell understands the idea of "a single thing" having spaces in it, it you use it in quote marks.

So you could say

MYPROG=/usr/bin/apt-get
MYARGS="-d upgrade -y"
...
if [ ! -x $MYPROG ] ...
...
$MYPROG $MYARGS

However, here's a thought - you want to run this from cron, I guess. You don't need to check for the existance of sendmail, it's a prerequisite for cron anyway, and you don't need to invoke a script, because you're actually only asking for one thing anyway.

Plus you probably need to run apt-get update first anyway ...

So, try this cron command ...

(whatever time specification you want) /usr/bin/apt-get -qq update && /usr/bin/apt-get upgrade --download --simulate

(I use the full-name commands in scripts, so I don't have to go to the man page when I forget what '-s' means! )

-jim

Reply via email to