Results 1 to 2 of 2
Hi,
I made a script that scans the LDAP for expired passwords then notify users using mailx about the expiration date / grace logins status.
When i run this script ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-21-2012 #1Just Joined!
- Join Date
- Nov 2012
- Posts
- 8
Problem - Script not running properly in crontab vs command-line
Hi,
I made a script that scans the LDAP for expired passwords then notify users using mailx about the expiration date / grace logins status.
When i run this script from the command-line everything run smooth...
When i run the script with crontab scheduled task... the mail subject is messed up and the message is sent as a .dat file attachment...
If you open the .dat attachment file with a text editor, you can find the message that would normally display in the email notification when the script is run from the command line.
I have run the script with env >/tmp/cron.log
to display the variables in cron versus command line:
Thru CRON :
SHELL=/bin/bash
MAILTO=root
USER=root
PATH=/sbin:/bin:/usr/sbin:/usr/bin
_=/bin/env
PWD=/
HOME=/
SHLVL=2
LOGNAME=root
Thru Command-line (working):
ORBIT_SOCKETDIR=/tmp/orbit-root
HOSTNAME=cserver
IMSETTINGS_INTEGRATE_DESKTOP=yes
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=cbbde748043c20bf4cad7ed40000000 e-1356094072.463675-209656733
HISTSIZE=1000
GTK_RC_FILES=/etc/gtk/gtkrc:/root/.gtkrc-1.2-gnome2
WINDOWID=39845892
QTDIR=/usr/lib/qt-3.3
QTINC=/usr/lib/qt-3.3/include
IMSETTINGS_MODULE=none
USER=root
GNOME_KEYRING_SOCKET=/tmp/keyring-A8WLJt/socket
SSH_AUTH_SOCK=/tmp/keyring-A8WLJt/socket.ssh
SESSION_MANAGER=local/unix:/tmp/.ICE-unix/2941,unix/unix:/tmp/.ICE-unix/2941
USERNAME=root
DESKTOP_SESSION=gnome
MAIL=/var/spool/mail/root
PATH=/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
_=/usr/bin/env
QT_IM_MODULE=xim
PWD=/srv
XMODIFIERS=im=none
GDM_KEYBOARD_LAYOUT=ca fr
LANG=en_US.UTF-8
GNOME_KEYRING_PID=2932
GDM_LANG=en_US.UTF-8
GDMSESSION=gnome
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HISTCONTROL=ignoredups
HOME=/root
SHLVL=3
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=root
QTLIB=/usr/lib/qt-3.3/lib
CVS_RSH=ssh
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-yiJ2MQqHND,guid=6c27653b7c31b18eb780c49300000075
LESSOPEN=|/usr/bin/lesspipe.sh %s
WINDOWPATH=1
DISPLAY=:0.0
G_BROKEN_FILENAMES=1
XAUTHORITY=/var/run/gdm/auth-for-root-ynSXpD/database
COLORTERM=gnome-terminal
Do you guys have any idea how to fix this problem ?
Thank you !
- 12-21-2012 #2Just Joined!
- Join Date
- Nov 2012
- Posts
- 8
Found the solution !
I had to add this line to /etc/crontab file in order to fix my problem
LANG=en_US.UTF-8


Reply With Quote
