Rotate the Token for a Single Instance
For the default single-instance installation, use rotate-token.
sudo bash -c '
read -r -s -p "New Telegram bot token: " RTMN_TELEGRAM_TOKEN
echo
export RTMN_TELEGRAM_TOKEN
exec /usr/local/bin/rtmn rotate-token
'
This command validates the new token, rewrites the environment file atomically, and restarts the service. If restart fails, it rolls back to the previous token.
Rotate the Token for an Account-Isolated Instance
For account-isolated installations, edit only that instance’s environment file and restart only that service.
sudoedit "/etc/rtmn/env-$INSTANCE"
sudo systemctl restart "rtmn-$INSTANCE.service"
sudo systemctl status "rtmn-$INSTANCE.service" --no-pager
The default rtmn rotate-token command targets the default single-instance layout. Do not use it for account-isolated services unless the binary version explicitly supports selecting the service name and environment file.
Update an Account-Isolated Binary
Stop only the target instance, replace that account’s binary, then start the service again.
sudo systemctl stop "rtmn-$INSTANCE.service"
sudo install -o "$ACCOUNT" -g "$GROUP" -m 0755 "$BINARY_SOURCE" "/home/$ACCOUNT/.rtmn-$INSTANCE/rtmn-$INSTANCE"
sudo systemctl start "rtmn-$INSTANCE.service"
sudo systemctl status "rtmn-$INSTANCE.service" --no-pager
Uninstall a Single Instance
sudo /usr/local/bin/rtmn uninstall
sudo /usr/local/bin/rtmn uninstall -purge
uninstall removes only the service. uninstall -purge also removes the environment file, logs, and installed binary.
Uninstall an Account-Isolated Instance
Remove one instance without touching other account-specific services.
sudo systemctl disable --now "rtmn-$INSTANCE.service"
sudo rm -f "/etc/systemd/system/rtmn-$INSTANCE.service"
sudo systemctl daemon-reload
Only after confirming the instance is no longer needed, optionally clean up its files:
sudo rm -f "/etc/rtmn/env-$INSTANCE"
sudo rm -rf "/var/log/rtmn/$INSTANCE"
sudo rm -rf "/home/$ACCOUNT/.rtmn-$INSTANCE"
Do not delete shared accounts, unrelated environment files, or other rtmn-* services.