0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

systemdでdenonの起動

Last updated at Posted at 2022-11-24
インストール(root)
useradd deno -m -s /bin/bash
su - deno
curl -fsSL https://deno.land/x/install/install.sh | sh
cat <<'EOL' >> ~/.bashrc
export DENO_INSTALL="/home/deno/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
EOL
source ~/.bashrc
deno install -qAf --unstable https://deno.land/x/denon/denon.ts
mkdir ~/example
cat <<'EOL' > ~/example/main.ts
import { serve } from 'https://deno.land/std@0.165.0/http/server.ts';
function handler() {
  console.log('log test');
  console.error('error log test');
  return new Response('Hello, World!');
}
serve(handler);
EOL
exit
cat <<'EOL' > /etc/systemd/system/example.service
[Service]
User=deno
WorkingDirectory=/home/deno/example
ExecStart=/bin/bash -c 'PATH=/home/deno/.deno/bin && denon run --allow-net main.ts'
[Install]
WantedBy=multi-user.target
EOL
systemctl enable example
reboot
アンインストール(root)
systemctl stop example
systemctl disable example
rm /etc/systemd/system/example.service
rm -rf /home/deno
userdel deno

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?