Sponsored Content
Operating Systems Linux Ubuntu Problems with a .sh file in cron Post 302576754 by Rautoner on Saturday 26th of November 2011 06:32:19 AM
Old 11-26-2011
Well, I have heard a lot about the environments. I usually run the script using 'bash tempcheck.sh'. The script is:

Code:
#!/bin/bash

TEMP=$(/usr/sbin/hddtemp /dev/sda | cut -d: -f3 | sed 's/..$//' | sed 's/ //')
echo $(date '+DATE: %m/%d/%y  TIME:%H:%M:%S') - Temperature was: $TEMP >> templog.txt
if [ $TEMP -ge 50 ]; then
poweroff
fi

I also have the SHELL, MAILTO, HOME and PATH variables set in the crontab file:

Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/home/server

And I was trying to run the script like so:
Code:
*/20 * * * * root /home/server/tempcheck.sh

or...
Code:
*/20 * * * * root /home/server/tempcheck

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Very urgent!! Cron problems

I'm having serious problems running cron. I want to create midnight backups of my files on my unix server and there is something wrong with cron. Here is what I do: First I saw that cron is running (while logged on as root) by typing "ps -aedf|grep cron" and I noticed that there is 1 instance... (4 Replies)
Discussion started by: pappous
4 Replies

2. UNIX for Advanced & Expert Users

Cron problems

Hi, I am having a few problems with cron. I have created a shell script (to rotate www logs - this works) and then did the following (as root) #crontab -e 2 0 * * 3 /cron_scripts/wwwlogs.sh ? w ? q # crontab -l entry not shown e.g. it did not show what I had just writern I then... (6 Replies)
Discussion started by: warrend
6 Replies

3. UNIX for Dummies Questions & Answers

cron problems

Hi there, this time a have a other problem :) i will start a script over the cron. if i start the script manual (per command) it works without any problems, but over the cron it doesent work. my cron looks like this: 26 15 * * * /path/scriptname.sh 2> /path/error.log there is no... (3 Replies)
Discussion started by: scotty
3 Replies

4. UNIX for Dummies Questions & Answers

Problems using rsync with cron

Hi, I've created a cron job for a script with a rsync command in it. The script is named pull.sh and contains the following line : What it is supposed to do is pull backup files from the production server of my company to my local server. It should also generate the log file (output.log)... (1 Reply)
Discussion started by: anaigini45
1 Replies

5. Shell Programming and Scripting

Problems with Cron and isql

Dear Friends, I am running a script which runs a select query from a sybase table and outputs the result (1 row) into a .txt file in unix. When I run the script manually it behaves normally. However it doesnt run in crontab. #!/usr/bin/ksh . /opt/ivb/config/set_env ... (1 Reply)
Discussion started by: santoshpayal
1 Replies

6. Programming

execution problems with cron

how to store a date into file? and how we can access date from the file? ---------- Post updated at 06:09 AM ---------- Previous update was at 06:08 AM ---------- how we can store date in file? (1 Reply)
Discussion started by: causalmodi777
1 Replies

7. UNIX and Linux Applications

Execution Problems with Cron

Hi all!! I have a nerve-wracking concept (probably for me!!) which is not understood. My crontab entry looks this way. 33 09 22 3 * /home/myexp.sh "Bgp4 ALL" >/dev/null 2>&1 But cron gets started occasionally. Sometimes it does. Sometimes it does not. And sometimes it hangs in the middle (I... (1 Reply)
Discussion started by: dhivyasuresh
1 Replies

8. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Hi friends, today i created a cron job , registered the crontab file associated but dont know why the cron is not getting executed at the right time.?? content of Crontab file : 21 15 * * * /subrat/myt i wanted to execute the script myt on 15:21 PM of everyday. the script myt... (2 Replies)
Discussion started by: paras.oriental
2 Replies

9. UNIX for Dummies Questions & Answers

cron problems

I am trying to setup a cron that runs a script to update my ip for my domain name every time I reboot and checks if my ip changes every 5 minutes and if it does then I update it. I am running Ubuntu server 12.04. The file /etc/cron.d/ipupdate contains # # # Run ipupdate # # /5 * ... (3 Replies)
Discussion started by: Bros2
3 Replies

10. UNIX for Dummies Questions & Answers

Execution Problems with Cron

Good evening, ive got this cron to be run: if i run this manually it doesnt work,it takes me to the prompt again /export/app/CO/opge/scr/Informe_parametros_colombia.ksh >/dev/null 2>&1 here is the code fragment: coopge@coopge: opge PRODUCCION>more... (1 Reply)
Discussion started by: alexcol
1 Replies
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/ksh93, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/ksh93, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh, and /usr/sfw/bin/zsh. /etc/shells overrides the default list. Invalid shells in /etc/shells could cause unexpected behavior, such as being unable to log in by way of ftp(1). FILES
/etc/shells list of shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.11 20 Nov 2007 shells(4)
All times are GMT -4. The time now is 07:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy