Ubuntu :: Grep Doesn't Work In A Simple Cron Job
Jan 22, 2011
I have a problem with grep in my cron job:
A simple command like this doesn't work
Code:
Of corse I have tried with full path like this
Code:
Both of this scripts work fine when started from my shell. Unfortunately they don't work when executed from cron job, and I get an empty p.txt file.
Here is my crontab file:
Code:
Have any one of you faced this kind of problem before ?
View 3 Replies
ADVERTISEMENT
May 16, 2011
Here's what I want to do: Copy the whole Ubuntu 10.04 partition/installation from my old laptop to the new one.
What I tried: Used Simple backup to back up my Ubuntu installation to a USB hard drive. It yields a 10.4 gig folder containing 7 files. Installed 10.04 on the new laptop, used Synaptic to install Simple Backup, plugged in USB drive, started Simple Backup Restore, tagged the backup directory in Simple Backup Restore, and get the error:
Error: no backups found in the target directory.
I also tried copying the backup to the local drive, same difference.
View 7 Replies
View Related
Mar 2, 2010
I have a problem with mp3blaster.
I want cron to act as an alarm clock: first, it plays an mp3 file and then it runs the speech synthesizer festival which tells me to get up and do stuff.
Now, mp3blaster doesn't do anything when I run it from cron, but festival works without problems.
I've found some possible causes for mp3blaster not working through cron. Someone suggested that pulseaudio is not started. This shouldn't be the problem for me, since I don't even have pulseaudio installed, and festival is playing sound without problems...
I don't know what I should do to make it work.
Here is my script - runalarm.sh:
Code:
I don't want to include the wakeup text here since it contains profanity.
The mp3 player could be another one too. mp3blaster happens to be the only player I know that is easy to run from console, like this "mp3blaster goodsong.mp3", without and playlist creation or other stuff like that.
I can run the runalarm.sh from SSH console and it works fine, the mp3 starts playing and festival speaks after that. When run from cron, festival starts speaking right away and no mp3 is heard.
View 7 Replies
View Related
Jun 1, 2010
I have a simple cron job that runs every night & I tested this manually by just running the command as root in bash and all worked fine. It took some time but the crob job finished and I got my results emailed to me perfect / as expected.
Here is root's cron job listing:
Code:
Now I noticed that I never ever got anything emailed to me the following day so I am wondering if perhaps the Cron daemon doesn't have permissions or has an issue running / executing the command rather than when I test the command as 'root'? When I view my logs, I can see the command being executed and don't see any errors however I don't get email results when Cron runs the job rather than me taking the command and running it manually in Bash...then it works. What am I missing?
Code:
View 9 Replies
View Related
Oct 5, 2010
I created a very simple cron job for testing my first Linux system but It doesn't work. After open the crobtab file by typing crontab -e, I put a line like this to send email in every 2 minutes to report disk usage:MAILTO=dan@gmail.com*/2 * * * * du -s /homeI tried to restart cron several times but I still got nothing worked. /etc/init.d/crond restart
View 14 Replies
View Related
May 4, 2010
i am very sorry if this has been asked before... i'm sure it has.. but i have searched all over the net looking for an answer and i still cant find it...
I have a really simple cron job script like this:
When i run this manually it works fine but when i run it from my ROOT user in Plesk as a cron task is always creates a file that is just 45 bytes. Why doesn't it work... I am running it as a root user.. so surely i must have permission to access the file?
View 7 Replies
View Related
Jun 10, 2010
I'm trying to set up a simple backup script with cron.
In "crontab -e" (and sudo crontab-e - I tried both) I enter "0 22 * * * /home/USERNAME/.backup.sh", with the hope that it will run the script at 10pm each day. The srcipt work fine if I run in a terminal. why it won't work? It's bound to be something obvious....
View 5 Replies
View Related
Aug 28, 2009
Is there something that blocks cron from running a shutdown command? I'm doing a daily bounce to break an attack (I have thread about that in security forum), but I always end up doing it manually. The cron log shows it being fired off at the right time...but the server never bounces. I thought maybe I just missed it, but there is nothing in messages that shows the server restarting (unlike when i do it manually, you see the start-up logging).
View 2 Replies
View Related
Feb 10, 2010
I am unable to run my cron tab job without root password.I made a little research on the forums and appearantly it should be changed.Must I change "passwd" part with my root password?
View 9 Replies
View Related
Dec 17, 2010
I want to search files (basically .cc files) in /xx folder and subfolders. Those files (*.cc files) must contain #include "header.h" AND x() function. Clearly, I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings.
I tried several ways, and got only files with header.h OR x(). Some examples given in Internet doesn't give any result in my system. I am using Fedora 8.0 in my PC and I have grep 2.5.1 version.
View 5 Replies
View Related
Mar 27, 2011
I have a script, echoSmart.sh:
Code:
#!/bin/bash
smartctl -a /dev/sda > /smartlogs/sda-$(date).txt
[code]....
View 3 Replies
View Related
Apr 4, 2011
I've tried to get cron to run a script, but it does not work. At first I put it into /etc/cron.hourly, with no succsess. Then i added the line
Code:
To the crontab, with the same result.
I'm sure cron runs fine besides that Problem, because commands like
Get executed.
View 12 Replies
View Related
Jan 6, 2010
I've been trying to accomplish this on my own, but I can't seem to figure it out...
All I'm trying to do (for learning purposes) is to get a message to print out to a log file every 5 minutes.
This is on Ubuntu Server 6.06.
Logged in as root ( I know, I know, should have sudo'd, oh well... )
Created a new file with this in it:
Code:
Added this line:
Code:
( I wasn't sure the proper command to try every 5 minutes, but this is my latest iteration. I also started with just */5, and that didn't seem to work either. )
Saved and exited crontab.
Console reports:
Quote:
Using command: ps -ef | grep cron
Quote:
So I waited 10 minutes to be safe.... and saw no log file appear.
I checked this page here: [url]
I wasn't sure what it meant by the PATH= variable they wanted me to set, my /etc/crontab file states:
Code:
But I didn't know if it meant there, or in my crontab -e location, so after the first failed attempt, I added the line from that webpage as well to crontab -e:
Code:
Waited another 10 minutes to be safe, still nothing.
View 4 Replies
View Related
Jun 1, 2011
I'm trying to start a script through crond. The record in crontab is: 30 16 * * * /home/alex/razhodilim.pl 1>/dev/null. The script razhodilim.pl works perfectly if I start it manually. But cron fails to start it.
What could be the reason?
View 9 Replies
View Related
Oct 4, 2010
I have the following cron entry but it doesn't seem to be running:
Code:
The script does exist. And so does the directory /home/usr/log and writable. /var/log/syslog only has a bunch of these:
Code:
I don't see any file gets written to the log directory. That suggests to me that cron didn't run the job, as confirmed by /var/log/syslog.
View 9 Replies
View Related
Mar 25, 2011
I have a backup sh file that I have been using for a long time. It has always worked. 2 Days back I switched to a different pc and now suddenly the script don't work.If I run it manually in the terminal it works. But when it execute with cron it doesn't copy any files to the backup destination. It starts but doesn't copy anything.Can someone help me as to why it works manually but not with cron ?
View 9 Replies
View Related
Oct 15, 2010
I set up some scripts n crontab and I found that the scripts are failing because cron seems not to load my user PATH variable. Is there any way to tell cron to load my PATH variable?
View 2 Replies
View Related
Oct 6, 2010
I can't seem to get a cron job to work on my Fedora 11 box. When I check the logs, cron is actually working. In my /etc/crontab I have an entry to run the cron job on my Moodle installation:
30 * * * * wget -q -O /dev/null http://moodle.name.name/moodle/admin/cron.php
when I run crontab -l it is not showing me anything, I am confused
View 1 Replies
View Related
Feb 18, 2010
If sound on F12 works as root user but not as a normal user, try this simple fix! I've been struggling to get sound working as a normal (non-root) user since F10. Until now I've had to run X as root user to get any sound out of my machine.
Sound actually works OK now for me as a normal user. Here's how I fixed the problem.
First I uninstalled pulseaudio with:# yum remove pulseaudio Then reboot back to the hardware. You might want to keep pulseaudio, but I have no need for it. PA wasn't running on my system anyway.
Running X as root user, I did the following: As a test I opened a root shell and typed the following:
[root]# alsamixer c0 That started the alsamixer OK, and all the controls were accessible.
[Code]...
View 14 Replies
View Related
Oct 25, 2010
Cron refuses to work when trying to sync with a network drive. I am trying to setup a cron job to backup a folder in my home directory ('/home/scratch') to a folder ('home/internet_backup') that is mounted (using nfs) to a network folder. The folder ('home/internet_backup') is mounted correctly to the network folder upon system startup, so this part works.
I created a simple bash file (rsync-shell.1.sh) that looks like this:
Code:
# backup the contents of 'scratch' (of 'internet' machine) into '/home/aa/internet_backup/'
# the latter folder ('/home/aa/internet_backup/') is mounted to 'developer' machine
rsync -av --exclude=".*" /home/aa/scratch /home/aa/internet_backup/
#
When manually running this bash file from my home directory (./rsync-shell.1.sh) everything works, and the contents are written to the destination folder. Yet, instead of running this manually, I wanted this to be executed by Cron every 30 min. so I first chmod +x this file, and then copied it (using sudo) to /root.
I then created the following using 'sudo crontab -e':
Code:
# m h dom mon dow command
10 * * * * /root/rsync-shell.1.sh
This is the same bash file illustrated above, yet, it doesn't work (files are not being written to the destination folder).
View 2 Replies
View Related
Nov 23, 2010
What would happen if I place more than one shell script in the cron.weekly directory. would they run at the same time?
View 1 Replies
View Related
Sep 1, 2011
I'm using 'Adobe Flash plug-in 10.3.183.4ubuntu0.11.04.1', installed from the package repos on kubuntu, and since the last update, it has broken all flash functionality in both rekonq and firefox.I have tried removing and reinstalling the package multiple times, both with and without the browsers open. Can anyone suggest a way to restoring functionality?
View 7 Replies
View Related
Jan 12, 2010
I am having some trouble setting up a cron job that creates a tunnel to my remote machine to work correctly on Ubuntu 9.10. The setup looks like the following:
(1) myscript.sh (executable)
Code:
#!/bin/bash
ssh -2 -x -i /home/user/.ssh/id_rsa.prv -L 3128:myremotemachine:3128 myaccount@myremotemachine
(2) crontab -e, added the following lines:
[Code]...
View 5 Replies
View Related
Oct 7, 2010
i'm a college student studying pc programing, and i was given today a special work and i have to program using miranda... which i've never used it >.< can anyone give me a hand to where to download, how to compile, and a simple tutorial for making a simple program or something?
View 3 Replies
View Related
Nov 22, 2010
I need to kind of grep within grep. My input file would be something like:
[Code]....
and I need to find the first occurrence of hello before MY PATTERN (hello 9008 in this case), so the output should be:
[Code]....
View 4 Replies
View Related
Apr 29, 2011
Can anyone tell me how i change the default domain name for cron?everything i cron runs it emails from and to user@com.com
this leaves me with a massive list of failed mails in postfix.i have mailto on my main crontab but i cant do it on all of them.
View 1 Replies
View Related
Jul 5, 2011
I have installed CPAN module Spreadsheet::WriteExcel, to generate some reports. Now when i execute my perl module from command line. it works fine and generates the excel file. When i put this module to be executed via cron, it doenst work and an email is generated. My entry in cron tab is as follows:2 14 * * * perl /scripts/postpaidRecon/postpaid.plThe email i receive in /var/spool/mail/root for module failure is:
Subject: Cron <root@kblhpw101> perl /scripts/postpaidRecon/postpaid.pl
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
[code]....
View 3 Replies
View Related
Feb 25, 2010
It seems that cron is not upgrading my Ubuntu 8.04 LTS Server, no GUI installed. I changed /etc/crontab and watched apt running:
Code:
ps -A | grep apt
showed it for a long time,
Code:
sudo tcpdump tcp
showed communication with canonical sites,
but:
Code:
top
did not show any apt using CPU
[code].....
View 2 Replies
View Related
Sep 19, 2010
I put in my cron entries to run my backup script which rsyncs my data to my 2nd drive, however on a hunch I checked my backup drive which mounts automatically via fstab and I realize it had not ran in a while. I checked cron and there were no entries for it. I got to wondering if I should ever be worried about a cron update coming down and over-writing my existing cron file with the backup entries in it to run.
View 2 Replies
View Related
Feb 17, 2011
how to make creative web cam working with ubuntu
View 1 Replies
View Related