More: Array Subset, loop and xargs

Last week I had a requirement to fetch details of some records. For simplicity let’s assume records are id of some entity; I need to get details from an API for those id. Let’s also assume that API accepts 100 id at maximum in a single request. I’d almost 1 million id to fetch details.
Continue reading

Advertisements

Start service on system startup using Upstart

I’m using Upstart Event System to start uTorrent server when system is up. The setup process is pretty simple and the most useful advantage is- if the job gets terminated then it would be restarted.

Setting up job configuration file-
Continue reading

Anacron for specific user

Few days ago I was working to set up a backup reminder process for myself. After having few searches I observed anacron fits the best to solve my requirement- sending notification at certain frequency and at my availability too. The issue is sytem’s default /etc/anacrontab by default works for root user. We can execute a job for other users too by adding new group and user to the same. When I did that I saw though the execution time has been logged successfully but that job was silently failing to notify me. So I left that approch and setup a separate anacron instance to run for my profile.
Continue reading

Automated reminder service for backup

I’m very much used to with cron jobs which are used frequently to schedule tasks. Cron can run as often as every minute. But it assumes that the system is running continuously and if the system is not up at the time when a job is scheduled, that job is not executed. I was in need of something like cron but the executing time must be dynamic. More specifically I had to run a backup reminder process in my local system automatically on a certain period frequency and only when the system is on.
Continue reading

Multi-processing using shell script

I love concurrency. Writing a concurrent program is always complex. There are different technologies which are most suitable to do this job. In an earlier post I briefed how to achieve parallelization using PHP. Parallel processing can be done using shell script also; by spawning multiple child processes. It’s fairly simple to handle basic concurrent tasks in that manner.

A basic example to achieve the same-
Continue reading