From: Pussala on
On 2 Mag, 22:07, ibupro...(a)painkiller.example.tld (Moe Trin) wrote:
> On Thu, 1 May 2008, in the Usenet newsgroup comp.security.firewalls, in article
> <9517d840-06b9-4ea9-bc2c-fd8199412...(a)25g2000hsx.googlegroups.com>,
>
> r...(a)bcm.tmc.edu wrote:
>
> NOTE: Posting from groups.google.com (or some web-forums) dramatically
> reduces the chance of your post being seen. Find a real news server.
>
> >ibupro...(a)painkiller.example.tld (Moe Trin) wrote:
> >> Puss...(a)gmail.com wrote:
> >>> I want automatic upgrade_export.
>
> >> And what does this have to do with firewalls?
>
> >Because he is discussing an issue with Checkpoint upgrade_export
> >maybe.
>
> Barking at the wrong tree - his problem is a fundamental mis-understanding
> of the UNIX 'cron' daemon, and has nothing to do with any firewall. His
> post in this group continued:
>
> If I run commands without crontab all ok!
> With crontab run upgrade_export but does not create anything!
>
> So there is nothing wrong with the commands (what ever they may be), but
> they fail to run in his rather bizarre interpretation of what the manual
> page says for 'crontab'. That's also why (after answering his question)
> I suggested he look at an appropriate UNIX newsgroup, or comp.unix.shell.
>
> >I see he did go towww.cpug.organd asked the same question and got an
> >answer.
>
> He posted from googlegroups, and (like many) I filter those posts off
> in a number of the other newsgroups I try to scan daily, but I also
> see that he posted to (at least) 'comp.os.linux.misc' and got an answer
> similar to the one I provided - run all of the commands out of a single
> script, rather than running five independent (and unrelated) commands
> out of root's crontab.
>
> Old guy

I edit script for backup:

#!/bin/sh
.. /etc/profile.d/CP.sh
cd /var/CPbackup/backups
echo | backup -d --file /var/CPbackup/backups/
scp fw_export pluto(a)172.29.198.23:/data/backup
exit 0

Can I exec the backup command without me being asked "Are you sure you
want to proceed?"
The command "echo |" not work !!!

Thanks
From: Moe Trin on
On Mon, 5 May 2008, in the Usenet newsgroup comp.security.firewalls, in article
<c36a495b-05aa-4d03-9862-55261ceae9e9(a)s50g2000hsb.googlegroups.com>,
Pussala(a)gmail.com wrote:

NOTE: Posting from groups.google.com (or some web-forums) dramatically
reduces the chance of your post being seen. Find a real news server.

>I edit script for backup:
>
>#!/bin/sh
>. /etc/profile.d/CP.sh
>cd /var/CPbackup/backups
>echo | backup -d --file /var/CPbackup/backups/
>scp fw_export pluto(a)172.29.198.23:/data/backup
>exit 0
>
>Can I exec the backup command without me being asked "Are you sure you
>want to proceed?"

You would have to check the manual page for the 'backup' command (which
is not a Linux or UNIX standard command) to see if it has an appropriate
option - I can't imagine why it needs to ask you to proceed. Could this
be a variable that is set in the /etc/profile.d/CP.sh file?

>The command "echo |" not work !!!

At least two problems. First, the 'backup' command has to display the
stupid question, but where does it do this? 'cron' has no standard
terminal, so it _may_ be trying to send the question via email to the
person running this crontab. A solution to that is to redirect stdout
to a file or device, such as /dev/null.

Second problem - the 'echo |' command is going to echo a carriage
return

[compton ~]$ echo | hexdump
0000000 000a
0000001
[compton ~]$

into the pipe, but is the backup program expecting input when invoked?
In your original post you indicated that things worked from the command
line, but not from cron. Does the 'echo |' work at the command line?
If it does, you might try

echo | backup -d --file /var/CPbackup/backups/ &>/tmp/somefile

to see if it's the lack of output device for cron that is causing the
problem.

Old guy