Notices


Reply
Thread Tools
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#11
Benson

1. If this was one of the UNIX servers I have managed for the last 15 years, yes you would be right but this is a personal tablet. I don't know about you, but I, haven't got the memory of a goldfish and tend to know what I've done from one day to the next so I'm pretty unlikely to use it in another script.

2. Both the script name and the '|more' are obviously optional.

3. I wonder which is the most '******ed' replacing an accurate (and available) time based tool (cron) with a script using 'sleep' or using accurate (and available) tools find and grep in a way they were meant to be used to replace something currently unavailable!

Lastly, I pride myself on having manners something you are obviously Not Familiar with.

Albright

A useful header for crontab files

Code:
#############################################################################
#                         crontab fields
# 
#                           * * * * * [command]
#                           | | | | |
#  minutes 0-59,10,15 ------- | | | ------ day of the week 0-7,3,5
#                             | | |
#       hours 0-23,3,5 -------- | ------- month 1-12,5,7
#                               |
#                    Day of the month 1-31,19
#
#  A "-" (dash) denotes a range and a "," (comma) distinct values
#
#  for example 1-3 in the hours would specify run at hours 1,2 and 3          
#  whereas 1,3 in the hours would specify run at just hours 1 and 3
#############################################################################
Some modern cron implementations allow you to use month and day names as well I haven't tested this on the tablet.

Regards
Rick
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#12
Thanks for the script rcull, I used it fine. I have a cron service running, and I chmodded the scripts and edited crontab with leafpad.

Although 2 unintended mistakes in scripts.

Meia should be media and locatedb should be locate.db (or the other way around depending on which script you edit first
 
Posts: 145 | Thanked: 32 times | Joined on Dec 2007
#13
I must be pretty dense, but I can't find any
crontab command on my n810 and there
doesn't seem to be any cron service available.

(I *know* what cron is and the syntax - I
just don't know how to install the cron
service on my n810).
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#14
Search for cron on this forum, I found a attachment that installed cron (it doesn't come with the ITT by default).

BTW: Is there any vi for dummies? The only command I know is :wq :\

I had to use some own tricks & leafpad to edit cronttab.
 
Posts: 145 | Thanked: 32 times | Joined on Dec 2007
#15
thanks Faheem - found it

very basic vi:

i - insert mode
esc - exit insert mode
ZZ - save & exit vi

editing more less works as expected
 

The Following User Says Thank You to albright For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#16
Thanks for that vi was killing me lol.
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#17
qwerty12

A very good vi reference card (pdf)
http://limestone.truman.edu/~dbindner/mirror/vi-ref.pdf

A nice tutorial
http://http://www.eng.hawaii.edu/Tutor/vi.html

regards
Rick
 

The Following User Says Thank You to rcull For This Useful Post:
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#18
Originally Posted by rcull View Post
Benson

1. If this was one of the UNIX servers I have managed for the last 15 years, yes you would be right but this is a personal tablet. I don't know about you, but I, haven't got the memory of a goldfish and tend to know what I've done from one day to the next so I'm pretty unlikely to use it in another script.
My point was not that you would use it in a script (and watch it fail), but that you would be unable to use it in a script -- or, more importantly, a pipeline. And when you post in a public forum, it's not just your personal tablet. You're advising other people to install a script with wrong behavior on their systems without even mentioning the utility/convenience tradeoff you chose to make.
2. Both the script name and the '|more' are obviously optional.
Obviously to you and me, but not necessarily obvious to everyone who reads the forum. I was a beginner once, and would type things in without trying to understand them. Then I'd tinker with them to try to get it. While this script is small enough most people should understand, realize what the | more did, and remove it, there are some who wouldn't. All I tried to do with my first comment was point out that it was optional, and that there were reasons to consider removing it, instead of presuming everyone else would catch it.
3. I wonder which is the most '******ed' replacing an accurate (and available) time based tool (cron) with a script using 'sleep' or using accurate (and available) tools find and grep in a way they were meant to be used to replace something currently unavailable!
Wow, 2 strawmen in one sentence.
  1. I didn't suggest calling this crond! You could write a real crond in shell script, using the techniques applied in this, but I would strongly advise against calling anything that runs only one fixed task on a fixed schedule by the name of a general purpose tool. (That would be ******ed!) That script was intended as a separate daemon to solve one problem, while cron was (to my knowledge) unavailable.
  2. My claim was not that using find and grep to replace locate was ******ed, but that taking that (admirable, in itself) locate replacement and breaking it by sticking extra functionality in is ******ed, and I'll stand by that.
Lastly, I pride myself on having manners something you are obviously Not Familiar with.
I can see why you'd feel the need to point that out; few would guess it from your suggestions that others might have "the memory of a goldfish". I'd rather be right than polite, but to each his own.
 
free's Avatar
Posts: 739 | Thanked: 159 times | Joined on Sep 2007 @ Germany - Munich
#19
We now have
not grep ;p
not locate
not slocate
but the great secure and fast Mlocate

mlocate is a new implementation of locate, a tool to find files files anywhere in the filesystem based on their name, using a fixed pattern or a regular expression. Unlike other tools like find(1), locate uses a previously created database to perform the search, allowing queries to execute much faster. This database is updated periodically from cron.

Several implementations of locate exist: the original implementation from GNU's findutils, slocate, and mlocate. The advantages of mlocate are:

* it indexes all the filesystem, but results of a search will only
include files that the user running locate has access to. It does
this by updating the database as root, but making it unreadable for
normal users, who can only access it via the locate binary. slocate
does this as well, but not the original locate.

* instead of re-reading all the contents of all directories each time
the database is updated, mlocate keeps timestamp information in its
database and can know if the contents of a directory changed without
reading them again. This makes updates much faster and less demanding
on the hard drive. This feature is only found in mlocate.

Either you update the database :
* Through cron (a daily task is installed) or
* Manually by running updatedb (as root)

mlocate will remap your "/usr/bin/locate" and "/usr/bin/updatedb" to point to mlocate binaries.
It creates a new user/group for security reasons.
You can do normal searches:
PHP Code:
locate .mp3 
Or regexp based searches:
PHP Code:
locate -"libosso[^-].*postrm" 
I find it very efficient. I suggest to try it out, I've also put this on my PC and now replaces slocate.

Last edited by free; 2008-02-12 at 12:56.
 
Posts: 5 | Thanked: 0 times | Joined on Feb 2009
#20
Wonderful tool. Really had it missing.
It was hard to find because findutils points to busybox.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:09.