automatic upgrade_export

I want automatic upgrade_export.

[Expert@MNGFW01]# crontab -e:

50 12 * * * cd /opt/CPsuite-R62/fw1/bin/upgrade_tools

51 12 * * * echo | ./upgrade_export appoggio 25 13 * * * oggi=`date` 26 13 * * * mv appoggio.tgz.tar $oggi 27 13 * * * scp $oggi root@172.28.121.16:/data/backup_2008 [Expert@MNGFW01]# less /var/log/cron

Apr 30 12:50:00 MNGFW01 CROND[22798]: (root) CMD (cd /opt/CPsuite-R62/ fw1/bin/upgrade_tools) Apr 30 12:51:00 MNGFW01 CROND[22806]: (root) CMD (echo | ./ upgrade_export appoggio) Apr 30 12:52:24 MNGFW01 crontab[22820]: (root) LIST (root) Apr 30 12:53:19 MNGFW01 crontab[22821]: (root) LIST (root) Apr 30 12:54:14 MNGFW01 crontab[22827]: (root) BEGIN EDIT (root) Apr 30 12:54:26 MNGFW01 crontab[22827]: (root) END EDIT (root) Apr 30 13:25:00 MNGFW01 CROND[22966]: (root) CMD (oggi=`date`) Apr 30 13:25:54 MNGFW01 crontab[22972]: (root) LIST (root) Apr 30 13:26:00 MNGFW01 CROND[22974]: (root) CMD (mv appoggio.tgz.tar $oggi) Apr 30 13:27:00 MNGFW01 CROND[22980]: (root) CMD (scp $oggi root@172.28.121.16:/data/backup_2008 ) Apr 30 13:28:30 MNGFW01 crontab[22988]: (root) LIST (root) Apr 30 13:29:30 MNGFW01 crontab[22997]: (root) BEGIN EDIT (root) Apr 30 13:30:05 MNGFW01 crontab[22997]: (root) END EDIT (root)

If I run commands without crontab all ok! With crontab run upgrade_export but does not create anything!

What happens? Where is the error?

Reply to
Pussala
Loading thread data ...

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

And what does this have to do with firewalls?

  1. uname -a
  2. which cron
  3. man cron
  4. man crontab

Then add the following lines to this crontab:

52 12 * * * * set > /tmp/cron.environment.12.52 26 13 * * * * set > /tmp/cron.environment.13.26

and finally, run the command 'set > /tmp/my.environment

and then compare those three files in /tmp. You'll find that the environment is quite different, and commands that you run in a cron child process have no effect on _other_ child processes that may be spawned by the parent. As you've decided to do this in cron, create a single job that runs at a chosen time, such as

55 12 * * * run.this.silly.script

where 'run.this.silly.script' contains the actual commands

#!/bin/sh cd /opt/CPsuite-R62/fw1/bin/upgrade_tools echo | ./upgrade_export appoggio oggi=`date` mv appoggio.tgz.tar $oggi scp $oggi root@172.28.121.16:/data/backup_2008

Incidentally, that is a rather interesting extension for a file 'tgz.tar'

For further help, try an appropriate UNIX newsgroup, or comp.unix.shell. Do try to find a real news server first, as many people filter posts from groups.google.com.

Old guy

Reply to
Moe Trin

Because he is discussing an issue with Checkpoint upgrade_export maybe. I see he did go to

formatting link
and asked the same question and got an answer.

Reply to
rick

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

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.

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

Reply to
Moe Trin

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@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

Reply to
Pussala

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

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?

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

Reply to
Moe Trin

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.