Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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 :
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
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.
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
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.
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?
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
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
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
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 ;-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.