Skip to content

Running in background

Jacob Lundqvist edited this page Jul 9, 2024 · 7 revisions

Running iSH in the Background

Location tracking is enabled through /dev/location. Reading from this device will start tracking your location and output a line each time your location updates. This prevents iSH from suspending when in the background.

Manual Approach

You can get the app to run in the background with the following command:

cat /dev/location > /dev/null &

To stop running in the background:

killall -9 cat

Init Script Approach

If you use services and OpenRC, here is a service script that automates the task at every startup. Save it as /etc/init.d/runbg.

Then add the script to your startup services:

rc-update add runbg default

Replace default with sysinit if you don't want to switch to the default runlevel in your inittab.

Service Script

#!/sbin/openrc-run
#
# Copyright (c) 2021-2024: [email protected]
# License: MIT
#
# This service reads the GPS and discards the output to /dev/null.
# This is not tracking you in any way. The sole purpose of this
# is to ensure an iOS program continues to run in the background.
# This process has no noticeable impact on battery life.
#

description="Reads GPS to ensure iSH continues to run in the background"

command="/bin/cat"
command_args="/dev/location > /dev/null"
command_background="YES"

pidfile="/run/runbg.pid"
Clone this wiki locally