Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
06-19-2005, 03:37 AM
|
#1
|
LQ Newbie
Registered: Jun 2005
Posts: 4
Rep:
|
starting script, init by copy/create file in (samba) folder?
hiho =)
im looking for a way to start a script as soon as a file is created(or copied) to a folder (via xp-pc on a samba folder).
is there a way?
note: cronjob every minute is "my way" atm, but im not happy with it as the script will run again and again, also i often have problems with still opened/not completely written files
thx
muab
|
|
|
06-19-2005, 06:49 AM
|
#2
|
Member
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379
Rep:
|
Samba has two options called preexec and postexec:
Code:
preexec = /path/to/script &
postexec = /path/to/script &
By starting script in back ground you can have full control over it!
|
|
|
06-19-2005, 12:51 PM
|
#3
|
LQ Newbie
Registered: Jun 2005
Posts: 4
Original Poster
Rep:
|
many thx, its finally nearly working, at least once ;/
so when i (restart) sambad it works exactly one time.
so maybe 3 ideas why:
- i dont have a post exec, so the process isnt completed
- there is kinda timeout that has to be reached to be able to start the script again
- something else...
anyone just one more idea?
thx
muab
|
|
|
06-19-2005, 02:24 PM
|
#4
|
Member
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379
Rep:
|
Quote:
Originally posted by muab
many thx, its finally nearly working, at least once ;/
so when i (restart) sambad it works exactly one time.
so maybe 3 ideas why:
- i dont have a post exec, so the process isnt completed
- there is kinda timeout that has to be reached to be able to start the script again
- something else...
anyone just one more idea?
thx
muab
|
If you need delay in script use
sleep SECONDS command inside loop
Code:
while :
do
code
code
. ..
....
sleep 1 # ill sleep for 1 sec
done
|
|
|
06-19-2005, 04:37 PM
|
#5
|
LQ Newbie
Registered: Jun 2005
Posts: 4
Original Poster
Rep:
|
i allready tried thatm but the prob is that the script (in any way i treied so far) is executed just once =(
|
|
|
06-21-2005, 08:48 AM
|
#6
|
Member
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379
Rep:
|
Did you run script as
/path/to/script &
|
|
|
06-22-2005, 04:42 PM
|
#7
|
LQ Newbie
Registered: Jun 2005
Posts: 4
Original Poster
Rep:
|
found out that a magic script would be exactly (well, nearly ;P) what i need..
but still trying to read howtos/faqs to get it run ;P
(whats that & for at the end of the line?)
|
|
|
06-22-2005, 06:02 PM
|
#8
|
Member
Registered: Jan 2004
Posts: 35
Rep:
|
Hi, why do you whant to run a script when a file is copyed or creater over a samba share ?
Im just curious ;-)
|
|
|
All times are GMT -5. The time now is 08:08 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|