Need help on some shell script

dannygoh

Verified User
Joined
Feb 9, 2004
Messages
366
Location
Malaysia
Hi,

What's wrong on my shell script. I can run the command and I put on a shell script, it show errors

Code:
#! /bin/bash

date >> /root/server_health/remove_email_from_exim.log 2>&1
exiqgrep -if [email protected] | xargs exim -Mrm >> /root/server_health/remove_email_from_exim.log 2>&1

log file
Code:
xargs: exim: No such file or directory
 
For some reason the shell script can't find the exim executable. Try using the full path.

Jeff
 
Hello,

Try this:

Code:
#!/bin/bash
date >> /root/server_health/remove_email_from_exim.log 2>&1
exiqgrep -if [email protected] | awk '{system("/usr/sbin/exim -Mrm "$1)}' >> /root/server_health/remove_email_from_exim.log 2>&1

If you use "su" to switch to root, use it as "su -" so to have root's environment.

From man su

Code:
[FONT=Verdana]       -, -l, --login
[/FONT]              make the shell a login shell, clears all envvars except for TERM, initializes HOME, SHELL, USER, LOGNAME and PATH
 
Back
Top