Sponsored Content
Operating Systems Linux Problem with crontab + bash script Post 302365940 by wessberg on Wednesday 28th of October 2009 11:25:03 AM
Old 10-28-2009
Problem with crontab + bash script

Crontab:
Code:
16 14 * * * /root/bin/./empty_mail.sh >> /root/bin/log.txt
 
 
L=`mailq |grep -c frozen`
echo "${NUMMAIL} frozen mail to be removed from the mailq"
#echo "Press Enter to continue"
#read CONTINUE
echo -en "-> "
for i in `mailq | grep frozen | awk '{print $3}'` ; do
  exim4 -Mrm $i > /dev/null
done
echo "# Done"
echo ""

The script starts, but it doesnt clean the frozen mailque.

Anyone have a clue?

Last edited by Scott; 02-20-2010 at 01:32 AM.. Reason: Retro-fitting code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to execute sh script in bash shell via crontab

hello. we are porting over from HPUX Shell to Linux. my default shell is bash so i can no longer schedule to execute a sh script in crontab. can anyone pls help me out? I searched the site but didnt find any details. thanks! (1 Reply)
Discussion started by: jigarlakhani
1 Replies

2. Solaris

Unix script Problem with crontab

Hi Experts, Am facing some problems with script (Sun solaris 9). My script (sqlplus.sh)looks like this. . . ............................................... set 'date' dd=$3 export dd mon=$2 export mon yyyy=$6 export yyyy cd /oracle/P47/saparch... (8 Replies)
Discussion started by: vrjalli
8 Replies

3. UNIX for Dummies Questions & Answers

Variable problem in script when using crontab

Hi, this is my first shell script. Anyway i am trying to ftp files from one machine to another. The name of the script is ifsftp_orabkp. The code is as follows: HOST="122.122.122.22" USER="ftp_ftp" PASSWD="ftp.222222" Y1=`(perl -e '@y=localtime(time());printf... (11 Replies)
Discussion started by: dazz
11 Replies

4. Shell Programming and Scripting

Problem with crontab running a script

I am trying to use the CRON utility in Fedora 11 & CentOS... I intend to run a script which pops up a warning message every hour and i made the following entry using "CRONTAB -e " * * * * * sh /bin/myscript.sh But this does not seem to be running. Another thing to note is that,... (4 Replies)
Discussion started by: Vabiosis
4 Replies

5. Shell Programming and Scripting

Problem with perl script on crontab

Hi everybody, I have a perl script. I want to run it as a cron job every 10 minutes. I insert the command into crontab , using crontab -e. The problem is, I didnt get any output from script inside crontab, whereas when I run it manually through 'perl myscript.pl' it running well. Here is the cron... (2 Replies)
Discussion started by: franzramadhan
2 Replies

6. UNIX for Dummies Questions & Answers

Problem with a script in crontab

Hi guys, I have a shell script which i have put on crontab to run every min. Problem is that is isn't running. But if i run the script from the existing location it runs perfectly. but if i got out of the directory and run it giving the path. it doesn't work. sh script_name.sh ----... (3 Replies)
Discussion started by: nick1982
3 Replies

7. Shell Programming and Scripting

Cannot get this bash/expect script to run under a crontab

#!/bin/bash # # RAP configuration script # # Usage: ./rap.sh # # Requires: expect, tcl # # Script expects to find a file called rap.csv located in the same directory as the script. If the file is placed # in a different directory, modify the custom entries section to specify the absolute... (8 Replies)
Discussion started by: mrkool
8 Replies

8. Solaris

Script problem when running on crontab

Hi guys! I created a backup script that works fine when I run manually, but when I put a crontab job to execute it the result are not the expected. (not a time problem). Here is my script: bash-3.00# cat /bk_tool/backup2.sh #!/usr/bin/csh clear set DIR_HOST='SCP08' ... (3 Replies)
Discussion started by: andredemartini
3 Replies

9. Shell Programming and Scripting

Bash script acting funny when run from Crontab

Hello, first time here. I have a script that seems to ignore the if statement when run from the cron. I am using Ubuntu 12.10 #!/bin/bash DOWN=/usr/sbin/dcon UP="pon dsl-provider" LOG=/var/log/dsl-reconnect.log RECV=`ifconfig 2>&1|grep ppp0|cut -d , -f 5|cut -d " " -f 1` if ] then... (1 Reply)
Discussion started by: mkoster
1 Replies

10. Shell Programming and Scripting

Simple Bash Script - Crontab

I've put together a very simple bash script to check for software patches and bounce the server, once complete. This is on a Mac server. The script works just fine upon execution, however, cron responds with: /bin/sh: /usr/local/bin/softwareupdates.sh: No such file or directory Crontab: ... (6 Replies)
Discussion started by: Nvizn
6 Replies
PMDAMAILQ(1)						      General Commands Manual						      PMDAMAILQ(1)

NAME
pmdamailq - mail queue performance metrics domain agent (PMDA) SYNOPSIS
$PCP_PMDAS_DIR/mailq/pmdamailq [-b binlist] [-d domain] [-l logfile] [-r regex] [-U username] [queuedir] DESCRIPTION
pmdamailq is a Performance Metrics Domain Agent (PMDA) which extracts performance metrics describing the state of the e-mail queues managed by sendmail(1) and other mail transfer agents. The mailq PMDA exports metrics that measure the total number of entries in the mail queue, and the subtotals for entries that have been queued for various time periods. A brief description of the pmdamailq command line options follows: -b The binlist argument specifies a list of delay thresholds used to ``bin'' the entries in the queue into a a histogram based on how long the entry has been in the mail queue. The default thresholds are: 1 hour, 4 hours, 8 hours, 1 day, 3 days and 7 days. The entries in binlist are comma separated time intervals, using the syntax described in PCPIntro(1) for an update or reporting interval, e.g. the default list could be specified using the value 1hr,4hrs,8hrs,1day,3days,7days. Values in binlist are assumed to be in ascending order, and mail items in the queue less than the first threshold are binned into a special bin labeled ``recent''. -d It is absolutely crucial that the performance metrics domain number specified here is unique and consistent. That is, domain should be different for every PMDA on the one host, and the same domain number should be used for the same PMDA on all hosts. -l Location of the log file. By default, a log file named mailq.log is written in the current directory of pmcd(1) when pmdamailq is started, i.e. $PCP_LOG_DIR/pmcd . If the log file cannot be created or is not writable, output is written to the standard error instead. -r Use an extended regular expression to match file names in the mail queue directory, rather than assuming all "df" prefixed files in the directory are mail files (the "df" prefix is the sendmail convention, but this convention is not followed by other mail daemons). The regex pattern specified should conform to the POSIX format described in regex(3), and it describes file names that should be con- sidered mail. -U User account under which to run the agent. The default is the unprivileged "pcp" account in current versions of PCP, but in older versions the superuser account ("root") was used by default. The optional queuedir argument defines the directory in which pmdamailq expects to find the mail queue. The default is /var/spool/mqueue. INSTALLATION
If you want access to the names, help text and values for the mailq performance metrics, do the following as root: # cd $PCP_PMDAS_DIR/mailq # ./Install If you want to undo the installation, do the following as root: # cd $PCP_PMDAS_DIR/mailq # ./Remove pmdamailq is launched by pmcd(1) and should never be executed directly. The Install and Remove scripts notify pmcd(1) when the agent is installed or removed. FILES
$PCP_PMCDCONF_PATH command line options used to launch pmdamailq $PCP_PMDAS_DIR/mailq/help default help text file for the mailq metrics $PCP_PMDAS_DIR/mailq/Install installation script for the pmdamailq agent $PCP_PMDAS_DIR/mailq/Remove undo installation script for the pmdamailq agent $PCP_LOG_DIR/pmcd/mailq.log default log file for error messages and other information from pmdamailq PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
PCPIntro(1), pmcd(1), pcp.conf(5) and pcp.env(5). Performance Co-Pilot PCP PMDAMAILQ(1)
All times are GMT -4. The time now is 02:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy