rc.local, Cron Style
Occasionally as seasoned Linux users, we run across simple things we
never knew existed—and are amazed. Whether it's tab autocompletion,
sudo !! for when you forgot to type sudo or even recursive file listing
ls, the smallest tricks can be so incredibly useful. Not long ago,
I had one of those moments.
Most people know rc.local is the file where you put commands you want to have start on system boot. Sometimes the rc.local script is disabled, however, and it doesn't work. It also can be difficult to remember the syntax for starting a particular program as a specific user. Plus, having a long list of programs in rc.local can just become ugly. Little did I know, cron supports not only periodic execution of commands, but it also can start programs when the system starts as well!
A normal crontab entry looks like this:
* * * * * /usr/bin/command
That runs the command every minute. There are countless variations to get very specific intervals, but until recently, I didn't know there were options to the five fields. The following is a crontab entry that runs a command every hour on the hour:
And, there are many more:
most interesting for this article,
@reboot. If you have a crontab entry
it will execute when the system starts up, with the ownership and
permission of the person owning the crontab! I researched a lot to
make sure it wasn't just on reboot, but also on a cold boot—and yes,
@reboot terminology just means it runs once when the system first
boots. I've been using this as a quick hack to start programs, and it
works amazingly well.
I know 99.9% of you already knew this juicy bit of info, but for that .1% who have been living in the dark like me, I present you with a sharp new arrow for your system administrator quiver. It's a very simple trick, but all the best ones are!
|Happy Birthday Linux||Aug 25, 2016|
|ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs||Aug 24, 2016|
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
|What I Wish I’d Known When I Was an Embedded Linux Newbie||Aug 18, 2016|
|Pandas||Aug 17, 2016|
- Puppet and Nagios: a Roadmap to Advanced Configuration
- Writing a Simple USB Driver
- Android Candy: Hire a Cerberus to Find Your Phone
- Rebuilding a Laptop Battery
- Learning to Program the Arduino
- Creating and Theming a Custom Content Type with Drupal 7
- Real-Time Rogue Wireless Access Point Detection with the Raspberry Pi
- Grundig TV-Communications
- Best of Technical Support
- Book Review: Red Hat Linux 6 in Small Business
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide