Running in background - ish-app/ish GitHub Wiki

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 make the script executable and add it to your startup services:

chmod 755 /etc/init.d/runbg
rc-update add runbg default

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"