TERM: Undefined variable.

Status
Not open for further replies.

swiss196

Cadet
Joined
Aug 8, 2013
Messages
2
I've recently set up a new FreeNAS server for personal use.

Having configured it, I set up a few cron scripts to sync media from another server of mine and restart miniDLNA (to rescan) as new media is downloaded etc.

The sync script runs every minute via a freenas cronjob, but I've noticed I've been getting emails each minute as follows:

To: root
From: root (Cron Daemon)
Subject: Cron <root@dave-nas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/Vol1/Dave/Scripts/sync.sh
Body: TERM: Undefined variable.

After a quick Google it suggests it is to do with the .profile / .rc files that are processed when a shell is created but I've had a tweak but haven't managed to fix it!

Any suggestions?

NB: The Cron command is: "/mnt/Vol1/Dave/Scripts/sync.sh"
 

swiss196

Cadet
Joined
Aug 8, 2013
Messages
2
After some more investigation I managed to solve this by adding the TERM environment variable to the main crontab file, along with some other existing environment vars (SHELL, PATH).


Code:
mount -uw /
Code:
 
#add line to crontab now... (TERM=xterm)
 
mount -ur / 


EDIT: Oops!

Stupidly I forgot that the crontab would get restored on reboot so the extra line added above was lost. Consequently I found a way around this: Instead of adding this to the crontab directly, add "export TERM=xterm;" to your cron command, before the command you wish to execute (in the freeNAS webgui).

Code:
export TERM=xterm; tcsh /mnt/Vol1/Dave/Scripts/sync.sh


:)
 
Status
Not open for further replies.
Top