Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-30-2009, 01:30 PM   #1
LQ Newbie
Registered: May 2008
Posts: 5

Rep: Reputation: 0
incrontab cron how to combine commands

if anyone is familiar with incrontab

I am wondering how to combine commands, for instance:

this is my currently running command:
/home/afonit/Desktop/theone IN_ATTRIB convert -density 150 -format JPEG $@/$# $@/$#.JPEG

which is just saying for each file dropped into this cirectory convert it to a jpeg at 150 dpi.

but the problem is I then want it to run this command:

rm -fr /home/afonit/IMD/in/*

though I do not see a way to combine them. I know in the terminal I can just do a simple "&&" between them and it works great, but I don't see a way to do this in incrontab.
Old 01-30-2009, 01:36 PM   #2
Senior Member
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Not sure exactly what incrontab is, but it sounds like you could just make a script that does the two things & run that script from cron, i.e.:

#!/bin/tcsh -f

/home/afonit/Desktop/theone IN_ATTRIB convert -density 150 -format JPEG $@/$# $@/$#.JPEG && rm -fr /home/afonit/IMD/in/*
then run that script from a cron job.
Old 01-30-2009, 01:59 PM   #3
LQ Newbie
Registered: May 2008
Posts: 5

Original Poster
Rep: Reputation: 0
thanks, I will look into how to write scripts and execute them (never done that before) but it should be a good learning experience.

to answer your query of incrontab, it is like cron, but instead of being base on time, it is based on file system events - and uses inotify to do it.

So, if you want an action done when someone saves a file to a directory etc... icrontab is your guy.
Old 01-30-2009, 02:11 PM   #4
LQ Newbie
Registered: May 2008
Posts: 5

Original Poster
Rep: Reputation: 0
dang, that did it - and quick too.

thanks for your help, I really appreciate it, I will look and learn more about this scripting, again, I appreciate your time.


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
cron won't run commands? mma8x Linux - Software 4 04-05-2006 12:25 PM
[Torrent] CRON and Console commands Tanc Linux - Newbie 1 05-26-2005 12:00 PM
Combine cron with shutdown? jeopardyracing Linux - Newbie 3 11-13-2004 01:56 PM
Help with Cron commands ozstar Linux - Newbie 2 05-03-2004 04:07 PM
No mail in Solaris Cron commands markraem Solaris / OpenSolaris 1 01-05-2004 03:11 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:13 PM.

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