powenn / AltServer-Linux-ShellScript

Make easier to use AltServer-Linux
GNU Affero General Public License v3.0
198 stars 16 forks source link

Let's make the wifi refresh a background task? #47

Closed Macleykun closed 1 year ago

Macleykun commented 1 year ago

Heya pownn!

I wanted to suggest to maybe create something to run the wifi-refresh in the background!

I was thinking of making a systemd service file including: running as root: ./netmuxd & ./AltServer

I was thinking to help the user create the right systemd file with the script, as they could put the script anywhere they want (including the binairies).

What do you think? Is it an good idea to use systemd and the bash script to make it work withoud having a session open? I can help with the scripting :)

E.g.

current_dir=${pwd}
[Unit]
Description=Run netmuxd and Altserver in the background for wifi-refresh

[Service]
ExecStart=${current_dir}/netmuxd & ${current_dir}/AltServer

[Install]
WantedBy=multi-user.target

Abovei s just a quick example, probably isn't written correctly/with best practices :)

powenn commented 1 year ago

Not a bad idea,but do we really need it ? Commonly we just need to use AltServer once a week 🤔

Macleykun commented 1 year ago

Not a bad idea,but do we really need it ? Commonly we just need to use AltServer once a week 🤔

true, but i assume a user normally has a linux server in their home network, and not always have a tty open. They probably just want to come home/into the network, and press refresh.

AltServer needs to be running inorder to do that, but if you have to manually start it for each refresh you wanna do, it's a bit tideous.

I also think it'll be more gracefull to replace the kill commands with a systemctl stop serverx.service. That way the user interracts as usual, but it will already run in the background :D.

You also won't get an error anymore if a process isn't running while trying to kill it, which is a bit neater aswell!

powenn commented 1 year ago

So we replace WiFi refresh part to a separate systemd that we we can call it in script or anywhere ,seems have to write up a new option to create and recreate it if user move the whole directory to others places

powenn commented 1 year ago

Btw,could you help me to test the prerelease

Macleykun commented 1 year ago

Btw,could you help me to test the prerelease

already done so :), works like a charm fam!

Macleykun commented 1 year ago

So we replace WiFi refresh part to a separate systemd that we we can call it in script or anywhere ,seems have to write up a new option to create and recreate it if user move the whole directory to others places

yea, that's sadly a little challanging, but technically when the script is run, it can just recreate the service file and daemon-reload it :).

powenn commented 1 year ago

Then we need a pre written file with some variables,and using a function to replace them

Macleykun commented 1 year ago

Aye!Op 23 okt. 2022 om 14:34 heeft powen @.***> het volgende geschreven: Then we need a pre written file with some variables,and using a function to replace them

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

Macleykun commented 1 year ago

Heya, got it working in the background! altserver.service

[Unit]
Description=Run Altserver in the background for wifi-refresh

[Service]
ExecStart=/home/macley/AltServer-aarch64/AltServer

[Install]
WantedBy=multi-user.target

netmuxd.service

[Unit]
Description=Run netmuxd in the background for wifi-refresh

[Service]
Type=simple
Environment="ALTSERVER_ANISETTE_SERVER=http://45.132.246.138:6969/"
ExecStartPre=/usr/bin/sleep 10
ExecStart=/home/macley/AltServer-aarch64/netmuxd

[Install]
WantedBy=multi-user.target
Macleykun commented 1 year ago

Hey @powenn have you been able to look into this?