Service installation - rejetto/hfs GitHub Wiki
-
download HFS and put it in a folder, for example
C:\hfs
-
install nssm
-
at command line launch
nssm install hfs
-
set the "path" field to point at hfs.exe, for example
C:\hfs\hfs.exe
It's done, now HFS will automatically run at every start of your system, even before you log in.
You can start/stop the "hfs" service from the dedicated Windows tool, that you can launch by pressing Windows
key and typing services
.
The process is quite straight-forward and it works on Ubuntu 24.04 LTS:
- Create a new non-privileged user for hfs and create a directory to use as hfs' cwd:
sudo adduser --system hfs
sudo mkdir /var/lib/hfs
- Move HFS deliverable files in system directories:
sudo mv hfs /usr/local/bin/
sudo mv plugins/ /var/lib/hfs/plugins
- Change the owner of
/var/lib/hfs
:
sudo chown hfs:nogroup /var/lib/hfs
- Set capability to hfs executable to open low-numbered ports:
sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/hfs
- Create systemd service unit as follows:
[Unit]
Description=HFS
After=network.target
[Service]
Type=simple
User=hfs
Restart=always
ExecStart=/usr/local/bin/hfs --cwd /var/lib/hfs
[Install]
WantedBy=multi-user.target
- run
sudo systemctl daemon-reload && sudo systemctl enable hfs && sudo systemctl start hfs && sudo systemctl status hfs
- create a file /Library/LaunchDaemons/com.rejetto.hfs.plist with this content
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.rejetto.hfs</string>
<key>WorkingDirectory</key>
<string>/Users/USERNAME/.hfs</string>
<key>ProgramArguments</key>
<array>
<string>/Users/USERNAME/hfs/hfs</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Disabled</key>
<false/>
</dict>
</plist>
here, you should replace USERNAME with yours, and we are assuming that hfs is installed in /Users/USERNAME/hfs
sudo launchctl enable system/com.rejetto.hfs.plist
sudo launchctl load /Library/LaunchDaemons/com.rejetto.hfs.plist
- install node.js
- create a file
/etc/systemd/system/hfs.service
with this content
[Unit]
Description=HFS
After=network.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/npx -y hfs@latest
[Install]
WantedBy=multi-user.target
- run
sudo systemctl daemon-reload && sudo systemctl enable hfs && sudo systemctl start hfs && sudo systemctl status hfs
NB: update will be attempted at each restart
- install node.js
- run
npm -g i hfs
- run
npx qckwinsvc2 install name="HFS" description="HFS" path="%APPDATA%\npm\node_modules\hfs\src\index.js" args="--cwd %HOMEPATH%\.hfs" now
To update
- run
npx qckwinsvc2 uninstall name="HFS"
- run
npm -g update hfs
- run
npx qckwinsvc2 install name="HFS" description="HFS" path="%APPDATA%\npm\node_modules\hfs\src\index.js" args="--cwd %HOMEPATH%\.hfs" now