Tag Info

Hot answers tagged

5

This is a classic delayed expansion issue. Type help set or set /? from the command prompt for a discussion about delayed expansion (a bit past half way down the full help). Normal expansion using %var% occurs when the line is parsed. The problem is your entire FOR loop block is parsed in one pass. So you are seeing a constant value that existed before the ...


3

@dbenham is right on. I'll throw out an alternative. I find the delayed expansion a bit ugly and confusing for longer subroutines, so I'll tend to have a lone call as the "body" of a for loop. Inside the call variable expansion happens "normally". Observe: @echo off setlocal set start=1 set end=500 set interval=100 for /L %%g in (%start%, %interval%, ...


3

Copy the script to /etc/rc.d/rc.local, reboot and it will run at boot. E.g. [vagrant@localhost ~]$ cat /etc/rc.d/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local sudo touch ...


3

That's because it's sudo config, and you don't run sudo. sudo su - peeradmin -c "ls" might work. But really, should should be thinking more in terms of using sudo directly if it's just running commands. e.g. sudo -u peeradmin ls For which you'd need an alias: nagios ALL=(peeradmin) NOPASSWD: /bin/ls


1

You can try the following: create a file before the job starts and remove it, when it finished. 20 minutes after the job starts check if the file exists. If so then send a notification 00 07 * * * touch /tmp/run_trans_push.started; /u01/home/oracle/sysadm/run_trans_push.sh > /u01/home/oracle/trc/run_trans_push.sh_`date +\%b_\%d`.trc 2>&1; rm -f ...



Only top voted, non community-wiki answers of a minimum length are eligible