LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-24-2012, 11:24 AM   #1
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Rep: Reputation: 4
cant make crontab work.


Hello everybody.
I use an indexing program called recoll. I want to run recollindex (a command to force indexing update) at startup. From the command line I just have to type recollindex and it works perfectly
I have added various lines in my crontab :
Code:
@reboot /home/ioannis/bin/recollscript

@reboot /usr/bin/recollindex


@reboot /usr/bin/chromium-browser
recollscript is a simple script I created with 777 permissions that works pefectly from the command line
I just added the chromium-browser line just to make sure the problem was not in my commands
Yet nothing is executed

When giving
Code:
~$ sudo grep CRON /var/log/syslog
I get:

Code:
Oct 24 18:58:29 ioannis-desktop CRON[1186]: (ioannis) CMD (/home/ioannis/bin/recollscript)
Oct 24 18:58:29 ioannis-desktop CRON[1187]: (root) CMD (recollindex)
Oct 24 18:58:29 ioannis-desktop CRON[1212]: (ioannis) CMD (/usr/bin/chromium-browser)
Oct 24 18:58:29 ioannis-desktop CRON[1236]: (ioannis) CMD (/usr/bin/recollindex)
Oct 24 18:58:29 ioannis-desktop CRON[1138]: (ioannis) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Oct 24 18:58:29 ioannis-desktop CRON[1139]: (ioannis) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Oct 24 18:58:29 ioannis-desktop CRON[1137]: (ioannis) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Oct 24 18:58:29 ioannis-desktop CRON[1140]: (root) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Oct 24 19:17:01 ioannis-desktop CRON[5739]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
(they are the just the last few lines)
Any help would be greatly appreciable
 
Old 10-24-2012, 12:49 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Please remove the /home/ioannis/bin/recollscript and /usr/bin/chromium-browser lines and see this advice?
 
Old 10-24-2012, 02:27 PM   #3
medoc
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Rep: Reputation: 7
What makes you think that recollindex does not run actually ? Do you get an error indication somewhere ?
 
Old 10-24-2012, 02:34 PM   #4
medoc
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Rep: Reputation: 7
The "this advice" link above is not relevant, this would only be an issue for the real time indexer daemon (recollindex -m). The batch mode does not care about an X server.
 
Old 10-24-2012, 11:56 PM   #5
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by medoc View Post
What makes you think that recollindex does not run actually ? Do you get an error indication somewhere ?
I add a number in one of my files indexed before rebooting and after startup is not found by recall but gets found immediately after either running recollindex or recollscript. So I know it isnt executed
 
Old 10-25-2012, 12:33 AM   #6
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by unSpawn View Post
Please remove the /home/ioannis/bin/recollscript and /usr/bin/chromium-browser lines and see this advice?
I tried everything above, no difference
 
Old 10-25-2012, 12:42 PM   #7
medoc
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Rep: Reputation: 7
Ok, then I'd try to set up the recoll debug log and see if anything gets in there.

In ~/.recoll/recoll.conf:

loglevel = 6
logfilename = /tmp/rcltrace

Then reboot and see if anything gets in there (it's reset by every recoll command so you have to take a look before you do anything else with recoll).

Don't forget to reset the log level to 3 after, otherwise the log can get quite big.

If there is nothing in the log, I think that we can assume that recollindex does not start at all. Any special security feature activated on the system ?

I tried to do the exact same thing that you do by the way, it works for me, on a vanilla ubuntu 12.04 system.
 
Old 10-26-2012, 02:13 PM   #8
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by medoc View Post
Ok, then I'd try to set up the recoll debug log and see if anything gets in there.

In ~/.recoll/recoll.conf:

loglevel = 6
logfilename = /tmp/rcltrace

Then reboot and see if anything gets in there (it's reset by every recoll command so you have to take a look before you do anything else with recoll).

Don't forget to reset the log level to 3 after, otherwise the log can get quite big.

If there is nothing in the log, I think that we can assume that recollindex does not start at all. Any special security feature activated on the system ?

I tried to do the exact same thing that you do by the way, it works for me, on a vanilla ubuntu 12.04 system.
Thanks for your answer. Interestingly indexing at startup worked initially for some days when I gave the command in startup applications, then stopped working without apparent reason. Thats why I tried
Code:
crontab -e
I did as you said and here is what I got
Code:
:4:../utils/execmd.cpp:185:ExecCmd::startExec: (0|0) /usr/bin/ionice {-c} {3} {-p} {4142} 
:4:../utils/execmd.cpp:467:ExecCmd::wait: got status 0x0
:4:../rcldb/rcldb.cpp:602:Db::open: m_isopen 0 m_iswritable 0
:5:../rcldb/stoplist.cpp:36:StopList::StopList: file_to_string(/home/ioannis/.recoll/stoplist.txt) failed: open/stat: errno: 2 : 
:4:../rcldb/rcldb.cpp:634:Db::open: lastdocid: 17180
:4:../index/fsindexer.cpp:103:FsIndexer::index: Indexing /media/SUNDISK/AAPHF into /home/ioannis/.recoll/xapiandb
:2:../index/fsindexer.cpp:124:FsIndexer::index: error while indexing /media/SUNDISK/AAPHF: stat(/media/SUNDISK/AAPHF) : 2 : No such file or directory

:4:../rcldb/rcldb.cpp:581:Db::~Db: isopen 1 m_iswritable 1
:4:../rcldb/rcldb.cpp:696:Db::i_close(1): m_isopen 1 m_iswritable 1
:4:../rcldb/rcldb.cpp:706:Rcl::Db:close: xapian will close. May take some time
:4:../rcldb/rcldb.cpp:711:Rcl::Db:close() xapian close done.
Now the green line shows the problem: My directory (which is in a flash drive) does exist and is read when I give "recollindex" from the command line, yet here, it is stated that it does not exist. There is no possibility of some error in describing the directory as I added it from the GUI.
So it appears it is not a cron problem but rather recoll fails to read the directory.
Any idea?
 
Old 10-27-2012, 12:46 AM   #9
medoc
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Rep: Reputation: 7
Quote:
Any idea?
Well, yes, the stat(/media/SUNDISK/AAPHF) : 2 : No such file or directory message is a direct translation of a stat(2) system call. So if it says no such file or directory, this must be true.

Your removable volume is quite probably not yet mounted at this point of the machine startup.

I'd try to write a small shell script with a loop to test the existence of the volume then start recollindex, and start this from cron...

while test ! -d /media/SUNDISK/AAPHF; sleep 1;done
/usr/bin/recollindex

Cheers,

jf
 
1 members found this post helpful.
Old 10-27-2012, 09:27 AM   #10
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Original Poster
Rep: Reputation: 4
Thanks

Quote:
Originally Posted by medoc View Post
Well, yes, the stat(/media/SUNDISK/AAPHF) : 2 : No such file or directory message is a direct translation of a stat(2) system call. So if it says no such file or directory, this must be true.

Your removable volume is quite probably not yet mounted at this point of the machine startup.

I'd try to write a small shell script with a loop to test the existence of the volume then start recollindex, and start this from cron...

while test ! -d /media/SUNDISK/AAPHF; sleep 1;done
/usr/bin/recollindex

Cheers,

jf
Thanks a lot, you relieved my headache!
My HD is SSD , may be it explains why my flashdrive is not mounted when crontab is read, SSD is really fast
I ll mark the thread as solved
The test script didnt work and for the shake of readers of these lines in the future, a do should be included and no blank space between ! and -d should exist
Code:
while test !-d /media/SUNDISK/AAPHF; do sleep 1;done
What worked fine was just to put a line
Code:
01 * * * * recollscript
in my crontab file so it runs every hour, it comforts me very well
Cheers
Ioannis

Last edited by joham34; 10-27-2012 at 09:31 AM.
 
Old 10-28-2012, 02:28 AM   #11
medoc
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Rep: Reputation: 7
Sorry about the missing do, will test before I post next time. But there is definitely a space between the ! and the -d. You can't try it on the command line though as bash will take the ! for a history reference. So here goes the tested script, which will take the target directory as a parameter:

Code:
#!/bin/sh

if test $# -ne 1 ; then
    echo "Usage: testdir.sh <dirname>" 1>&2
    exit 1
fi

while test ! -d $1;do 
    sleep 1
done

recollindex
 
Old 10-28-2012, 12:09 PM   #12
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by medoc View Post
Sorry about the missing do, will test before I post next time. But there is definitely a space between the ! and the -d. You can't try it on the command line though as bash will take the ! for a history reference. So here goes the tested script, which will take the target directory as a parameter:

Code:
#!/bin/sh

if test $# -ne 1 ; then
    echo "Usage: testdir.sh <dirname>" 1>&2
    exit 1
fi

while test ! -d $1;do 
    sleep 1
done

recollindex
Yes you are right the blank space between ! and -d. I am struggling to learn well how to use these operators and tests in general. I constantly forget things. Difficult to remember when you are 48 ;-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to make sense of cron / crontab willy_gn Linux - Newbie 4 03-19-2011 10:13 AM
make Xconfig doesn't work, make menuconfig does work Debian/KDE bucovaina78 Linux - Kernel 1 10-15-2008 01:26 PM
Crontab does not work riotxix Linux - Software 15 12-14-2006 01:30 AM
work with crontab juanb Linux - General 1 06-05-2004 09:29 AM
crontab does not work need help Xris718 Linux - General 10 04-18-2004 08:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration