13
submitted 1 month ago* (last edited 1 month ago) by Gonzako@lemmy.world to c/linux@lemmy.ml

Hi!

I've a cronjob that I don't want to be concurrent but it needs to leave a long-running process after it does it's job that I set up with a nohup command.

The deal is that once the script has setup the lock doesn't get released so any further calls to the script just get ignored.

Is there a better alternative/flag I'd use? I couldn't discern much from the flock or nohup man pages.

Solved: With bit more fiddling found the - u flag on the flock man page. You can unlock yourself at the very end of the script.

you are viewing a single comment's thread
view the rest of the comments
[-] hades@feddit.uk 3 points 1 month ago

Can you modify the script to release the lock after the process has started?

[-] Gonzako@lemmy.world 2 points 1 month ago

Yes! I found the - u flag on flock and that got it working. Thanks for the attention anyway.

this post was submitted on 14 Oct 2025
13 points (100.0% liked)

Linux

57274 readers
343 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS