Sponsored Content
Full Discussion: weird script in crontab
Top Forums Shell Programming and Scripting weird script in crontab Post 302243020 by nls mchn on Friday 3rd of October 2008 12:30:20 PM
Old 10-03-2008
MySQL

Quote:
Originally Posted by otheus
It might be that there are multiple clam daemons running, or maybe that clamd is actually a username or something. Try this:

Code:
PID=$(ps hax -o pid,cmd | awk '/clamd$/ { print $1; exit; }')
MEM=$(ps wuh $PID | awk '{ print $6 }' )

(The MEM line grabs the memory usage as before, but this time only of the actual PID as found in the previous line.)

thx, no there are no clamd username and just 1 clamd daemon running.
The "exit;" in awk fixed it:
Code:
 PID=$(ps hax -o pid,cmd | awk '/clamd$/ { print $1; exit; }')
# and this also
PID=$(ps waux | grep "clamd" | grep -v "grep" | awk '{ print $2; exit; }')

It now works !! but I still don't understand Why ? the different behaviors
when executed from command line
or executed from crontab
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Weird script

I need a script to do the following and have no idea how to do it...can someone help? I need to start Sql*Plus, load a query, say "unmatched.sql", run the query, then load unmatched.sc and run it, then print the output file that unmatched.sc created... any help greatly appreciated. Duckman (2 Replies)
Discussion started by: Duckman
2 Replies

2. Solaris

Weird crontab problem

Greetings To All! I am running Solaris 10 in a sparc environment. Here is the deal: In /var/spool/cron/crontabs, there is a cron user named "sys". If I do a crontab -l sys, it returns: # 0 * * * 0-6 /usr/lib/sa/sa1 # 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 # 5 18 * * 1-5 /usr/lib/sa/sa2... (8 Replies)
Discussion started by: RobSand
8 Replies

3. HP-UX

Weird Issue with crontab.

Hello all, Normally I'm pretty comfortable with crontab, changing and updating (done it many-a-time). But in the last two days I've been pulling my hair out over the following... Details of OS: HP-UX mdirect B.11.23 U ia64 2587410573 unlimited-user license Issue: Execute a script (very... (3 Replies)
Discussion started by: Cameron
3 Replies

4. Shell Programming and Scripting

Help with my weird script!

So I have this script titled "testing.sh" #!/bin/ksh #PROGRAM INITIALIZATION HomeDir=/home/sap/gl/ftp server=testftp01 userid=ftp_uatollmsgbus password="f&p53715" MSGLOG=${HomeDir}/msglog.txt FTPLogTmp=${HomeDir}/testing.tmp FTPLogFile=${HomeDir}/testing.log... (1 Reply)
Discussion started by: kdyzsa
1 Replies

5. UNIX for Dummies Questions & Answers

Weird Behavior of a Script

ok, there's a script i'm working on written in shell programming. #!/bin/sh this script is written to spit out the contents of certain variables inside of it so the output looks something like this: server01=89 server02=69 server03=89 server04=76 now, when i run this script from the... (4 Replies)
Discussion started by: SkySmart
4 Replies

6. Shell Programming and Scripting

Weird sed behaviour in script

I've written a small script to replace certain words in all the the files in a directory. #!/bin/sh #Get list of files to be edited file_list=`ls -p` for i in $file_list do echo "Processing $i" alteredi=`echo "$i" | sed -e 's/\//d/'` if then if then #actual altering (2 Replies)
Discussion started by: Peetrus
2 Replies

7. Shell Programming and Scripting

script acting weird..

Hi Guys, I have this script which is being called from another script, sh +x SCRIPTNAME. Now this script is failing saying the source file is missing. But i was able to see the source file was present. It was renamed and but somehow the source file is removed. There is no remove command in the... (1 Reply)
Discussion started by: mac4rfree
1 Replies

8. Shell Programming and Scripting

Weird script behaviour !

Hello, I am getting an infinite loop from a script in Linux. Here is the last version of the script in question. As you can see I tried to define everything properly: #!/bin/ksh # Script to loop over a series of dates set -ex typeset -i start_date=20090701 typeset -i... (2 Replies)
Discussion started by: stavros
2 Replies

9. AIX

weird korn shell script

here is the one of the scripts: script1.kshfunction haha { print "calling haha" exit } script2.ksh. script1.ksh haha | tee -a /dev/null print "i am script 2" after launching the script2, the result: --------------------------------------------- calling haha i am script 2 ... (6 Replies)
Discussion started by: getter
6 Replies

10. Shell Programming and Scripting

Weird difference in script execution

Hi, So I have a very simple script which loops over 5 times and prints the iterator value. #!/bin/sh START=1 END=5 for i in $(eval echo "{$START..$END}") do echo "$i" done If I save this script in a .sh file and run it in the terminal, the output I get is {1..5} (4 Replies)
Discussion started by: jamie_123
4 Replies
freshclam(1)							  Clam AntiVirus						      freshclam(1)

NAME
freshclam - update virus databases SYNOPSIS
freshclam [options] DESCRIPTION
freshclam is a virus database update tool for ClamAV. OPTIONS
Freshclam reads its configuration from freshclam.conf. The settings can be overwritten with command line options. -h, --help Output help information and exit. -V, --version Print version number and exit. -v, --verbose Be verbose. This option causes freshclam to print much additional information. --debug Enable debug messages from LibClamAV. --quiet Be quiet - output only error messages. --no-warnings Don't print and log warnings. --stdout Write all messages to stdout. --config-file=FILE Read configuration from FILE. -l FILE, --log=FILE Log report to FILE. -d, --daemon Run in a daemon mode. Defaults to 12 checks per day unless otherwise specified by --checks or freshclam.conf. -p FILE, --pid=FILE Write daemon's pid to FILE. -u USER, --user USER Run as USER. By default (when started by root) freshclam drops privileges and operates as the '' user. --no-dns This option forces old non-DNS verification method (without a TTL delay). -c #n, --checks=#n Check #n times per day for a new database. #n must be between 1 and 50. --datadir=DIRECTORY Install new database in DIRECTORY. The directory must be writable for the '' user or unprivileged user running freshclam. --daemon-notify=/path/to/clamd.conf Notify the daemon about the new database. By default it reads a hardcoded config file but you can use a different one. Both local and TCP sockets are supported. -a IP, --local-address=IP Use (local) IP for HTTP downloads. Useful for multi-homed systems. If binding fails for whatever reason, a warning is issued and freshclam behaves like without this flag. --on-update-execute=COMMAND Execute COMMAND after successful update. --on-error-execute=COMMAND Execute COMMAND if error occurred. Remember, that virus database freshness is the most important thing in anti-virus system. With this option freshclam can alert you (eg. send SMS) when something is going wrong. --on-outdated-execute=COMMAND Execute COMMAND when freshclam reports outdated version. In the command string %v will be replaced by the new version number. --list-mirrors Print mirror details from mirrors.dat (cache file for the mirror manager). --submit-stats[=/path/to/clamd.conf] Upload detection statistics to the ClamAV Project (see freshclam.conf(5):SubmitDetectionStats for more details). No database update will be performed. This option only works in the interactive mode. --update-db=DBNAME With this option you can limit updates to a subset of database files. The DBNAME should be "main", "daily", "bytecode", "safebrows- ing" or one of the 3rd party database names. This option can be used multiple times and only works with the official and 3rd party databases distrubuted through the ClamAV mirrors, your custom databases (specified with DatabaseCustomURL in freshclam.conf) will not be ignored. --enable-stats Enable submission of statistical data. --stats-host-id=UUID HostID in the form of an UUID to use when submitting statistical information. EXAMPLES
(0) Download database to default directory: freshclam (1) Download database to current directory: freshclam --datadir=. (2) Run as a daemon and check 2 times per day for new database: freshclam -d -c 2 RETURN CODES
Some return codes of freshclam can be overwritten with a built-in command EXIT_n which can be passed to --on-*-execute, eg. --on-update-execute=EXIT_1 will force freshclam to always return 1 after successful database update. 0 : Database is up-to-date or successfully updated. 40: Unknown option passed. 50: Can't change directory. 51: Can't check MD5 sum. 52: Connection (network) problem. 53: Can't unlink file. 54: MD5 or digital signature verification error. 55: Error reading file. 56: Config file error. 57: Can't create new file. 58: Can't read database from remote server. 59: Mirrors are not fully synchronized (try again later). 60: Can't get information about '' user from /etc/passwd. 61: Can't drop privileges. 62: Can't initialize logger. FILES
/etc/clamav/freshclam.conf CREDITS
Please check the full documentation for credits. AUTHOR
Tomasz Kojm <tkojm@clamav.net>, Kevin Lin <klin@sourcefire.com> SEE ALSO
freshclam.conf(5), clamd(8), clamd.conf(5), clamscan(1) ClamAV 0.98.4 December 4, 2013 freshclam(1)
All times are GMT -4. The time now is 05:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy