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
Once configured, HFS will start automatically at every system boot, even before you log in.
You can start or stop the "hfs" service from the Services tool, which you can launch by pressing the Windows key and typing services.
You can start "Task scheduler" on Windows, and "create a basic task" for HFS. If you do, be sure to fill the "Start in" field, with the same folder of hfs.exe.
The process is quite straight-forward and it works on Ubuntu 24.04 LTS:
- Create a new non-privileged user for HFS and a directory for its executable, plugins and data:
sudo adduser --system hfs
sudo mkdir /var/lib/hfs
- Move the extracted HFS files into this directory:
sudo mv hfs /var/lib/hfs/
sudo mv plugins/ /var/lib/hfs/plugins
- Give the HFS user ownership of the directory and its contents:
sudo chown -R hfs:nogroup /var/lib/hfs
HFS needs write access to its executable's directory to update itself from the Admin panel. Do not make /usr/local/bin writable by the HFS user.
- Create
/etc/systemd/system/hfs.serviceas follows.AmbientCapabilitiesallows ports below 1024 (such as 80 and 443) and remains effective after updates, unlikesetcapon the executable:
[Unit]
Description=HFS
After=network.target
[Service]
Type=simple
User=hfs
Restart=always
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/var/lib/hfs/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/YOUR_USER/.hfs</string>
<key>Program</key>
<string>/PATH_TO_HFS/hfs</string>
<key>UserName</key>
<string>YOUR_USER</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Disabled</key>
<false/>
</dict>
</plist>here, you should replace YOUR_USER and PATH_TO_HFS.
sudo launchctl enable system/com.rejetto.hfs.plistsudo launchctl load /Library/LaunchDaemons/com.rejetto.hfs.plist
- install node.js
- create a file
/etc/systemd/system/hfs.servicewith 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
Note: the 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