media-tracker by michaelx is a self-hosted program to track TV shows and movies. There are several self-hosted trackers but this is the one I like the most and that works best.
This script is for bash under Linux, because on Windows/Cygwin the executable is not Cygwin native, but rather Windows so doesn't work.
To launch and stop it automatically use this bash script for Linux:
#!/bin/bash
# Don't quit immediately after starting the script because the processes may not close properly.
echo 'Starting media-tracker from michaelx...press q or Q to exit'
npm start --prefix "$HOME/git/media-tracker/server" >/dev/null 2>/dev/null &
npm start --prefix "$HOME/git/media-tracker/client" >/dev/null 2>/dev/null &
ans=c
while [[ "$ans" != "q" ]] && [[ "$ans" != "Q" ]]
do
echo "Reading keyboard..."
read -n1 ans
echo ""
done
ps aux | grep "$HOME/git/media-tracker/client/node_modules/react-scripts/scripts/start.js\|$HOME/git/media-tracker/server/node_modules/.bin/../json-server/lib/cli/bin.js" | awk '{print $2}' | xargs kill -2 2> /dev/null
If you want to do it with Microsoft PowerShell:
# https://create-react-app.dev/docs/advanced-configuration/
Write-Output "Starting media-tracker from michaelx...press q or Q to exit"
$server = Start-Process (REACT_APP_BROWSER=none npm start --prefix "E:\git\media-tracker\server") -passthru &
$client = Start-Process (REACT_APP_BROWSER=none npm start --prefix "E:\git\media-tracker\client") -passthru &
$condition = $true
while ( $condition ) {
$PressedKey = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
if ( $PressedKey.Character -eq "q" -Or $PressedKey.Character -eq "Q" )
{
$condition = $false
Write-Output "Closing programs..."
}
}
Stop-Job -Id $client.Id
Stop-Job -Id $server.Id
Wait-Job $server.Id
Wait-Job $client.Id
Write-Output "Done."
We use the variable "REACT_APP_BROWSER=none" to prevent web browser from launching automatically the URL "http://localhost:3000/".
Links
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.