I wrote a program run every 5 minutes from a bash script. It run ok, but when I reboot it doesn't start giving :
-bash: ./nokia: Fichier texte occupé ( text file occupied ) ?? I can't run it manually, same error. to solve this I have to recompile no changes in source code ( C) any idea ? Many thanks
Didn't find your answer? Ask the community — no account required.
J
Josef Moellers
If you can reproduce, run the program with "strace": strace -fo nokia.out ./nokia and then search the file "nokia.out" for "ETXTBSY".
The error itself means that the program tries to open some executable file (or a shared object) for writing but that file is currently in use.
Josef
M
Martin Gregorie
How is the wait handled? If you're running something like
stop = 0 while (stop) do nokia sleep 5m done
consider rewriting it as a cron script instead As an example, my internet connection is slow often enough that I check its speed every 10 minutes with this cron script in /etc/cron.d
# # Run at 15 minute intervals # ========================== # Results are sent to root # MAILTO=root
This cron script runs the "/usr/local/bin/adslchk -b 2>&1 >>/var/log/ adslchk" command at 2,17,32,47 minutes after each hour and writes the script output to /var/log/adslchk.
The advantages of this approach are that:
- the process is automatically started when the computer is rebooted
- the adslchk script only runs for a few seconds each time its started
M
Martin Gregorie
Are you sure your script or compiled program isn't attempting to overwrite the compiled binary?
lsof may show you what's going on:
"lsof -- ./nokia | less" - piping lsof through less is a good idea because lsof can produce a lot of output.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.