instaLooter may be used to update a local mirror of an instagram account,
and as such it may be desired to run it periodically, without needing to update
To support the UNIX philosophy, the program do not implement this feature itself but should integrate well with established alternatives. The following examples make use of either Cron or SystemD timers.
First of all, make sure
Cron is installed, and if not, refer to the
package manager of your distribution (if you’re on MacOS, give a try to
homebrew if not using it already !).
Cron to add a scheduled task:
$ crontab -e
This will open a file using the $EDITOR system variable to find a text editor, such as nano, pico, vi, etc. Then, add one line as one of the examples below to run instaLooter periodically (you can add more than one line if you have more than one goal in mind):
Download maximum 3 new
@hourly /usr/bin/env python -m instaLooter hashtag funny ~/Videos -N -n 3 -V
Download new pictures w/ metadata from the
@reboot /usr/bin/env python -m instaLooter instagram ~/Pictures/instagram -Nm
Use a configuration file to download in Batch mode every week on Sunday, 00:00
@weekly /usr/bin/env python -m instaLooter batch ~/myLooter.ini
To disable a scheduled task, simply remove the line associated to that task within crontab.
The CronHowTo hosted on ubuntu.org for a complete understanding of the crontab line format.
You’ll probably use this alternative if your system is already running on top of
SystemD. If not, you should probably turn to
Cron. Simply check for the
existence of a
systemctl executable (e.g. running
systemctl --help) to
see if you’re using SystemD.
Create a new service file, either in
/etc/systemd/system/ for system-wide jobs,
~/.config/systemd/user/ for user-only jobs, named for instance
looter.service (you can use any name as long as the file has a .service
extension), with the following content:
[Unit] Description=my custom periodic instagram looter [Service] Type=oneshot ExecStart=/usr/bin/env python -m instaLooter <the parameters I want>
Make sure the
instaLooter module is accessible to the
i.e. if you’re using system-wide jobs that the module was installed in /usr (not
pip insta --user instaLooter but with
pip install instaLooter).
To test your service, run
systemctl start looter.service (using the name of
your file), or
systemctl --user start looter.service if you want to use
user-only jobs. There should be no output if everything works fine.
If a bug occurs check the logs with journalctl:
# journalctl looter.service $ journalctl --user --user-unit looter.service
Once your service works fine, create a timer for your new service, named like
and located next to your service file, but with a
.timer extension, and
the following content:
[Unit] Description=run my custom periodic instagram looter hourly [Timer] # Time to wait after booting before we run first time OnBootSec=10min # Time between running each consecutive time OnUnitActiveSec=1h Unit=looter.service
Finally, enable and start your timer with one of the following commands:
# systemctl start looter.timer && systemctl enable looter.timer $ systemctl --user start looter.timer && systemctl --user enable looter.timer
To disable the timer, use the same command as above, replacing
disable, and remove the service and timer files
if you want to completely uninstall the timer.