Prior work
This commit is contained in:
commit
74412bbae8
10
cygnus.service
Normal file
10
cygnus.service
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Generate a new fortune for the cygnus landing page.
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=python /home/shoofle/cygnus/update_fortune.py
|
||||||
|
User=shoofle
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
10
cygnus.timer
Normal file
10
cygnus.timer
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Timer for update_fortune.py
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=daily
|
||||||
|
AccuracySec=1m
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
35
cygnus_log
Normal file
35
cygnus_log
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
enable ssh
|
||||||
|
use usermod to rename pi to cygnus
|
||||||
|
make a shoofle user, add her to sudoers with usermod, move the ssh pubkey over
|
||||||
|
|
||||||
|
set up samba
|
||||||
|
set up a samba password for the cygnus user maybe, so that i can get into the cygnus home folder
|
||||||
|
install nginx?
|
||||||
|
|
||||||
|
added the following lines to /etc/fstab to get 55 cancri b and ct chameleontis b to mount!!!
|
||||||
|
> #okay let's go into the scary realm
|
||||||
|
> PARTUUID=9eb03fc3-01 /media/55\040Cancri\040B vfat auto,exec,rw,sync,nouser 0 0
|
||||||
|
> PARTUUID=acafe9ba-747a-42dc-bd3e-3d6cf775a523 /media/CT\040Chameleontis\040b ntfs auto,exec,rw,sync,nouser 0 0
|
||||||
|
changed this later so that it mounted Gliese 180 a/b to /mnt/sthose, might eventually move them to /media, whatever
|
||||||
|
|
||||||
|
now editing the /etc/samba/smb.conf or whatever to reflect the new locations of those folders
|
||||||
|
|
||||||
|
gotta install fuse and ntfs-3g with apt-get
|
||||||
|
|
||||||
|
make sure that at least the relevant parts of the data store are chmod 777 because they need access from the guest user
|
||||||
|
|
||||||
|
installed nginx!
|
||||||
|
wrote a little landing page letting people know what cygnus is.
|
||||||
|
|
||||||
|
installed smartmontools for monitoring drive healt
|
||||||
|
|
||||||
|
installed fortune-mod so i can get fortunes
|
||||||
|
|
||||||
|
installed python-is-python3 and python3-pip so that i can have python working better
|
||||||
|
|
||||||
|
wrote the service and timer files for updating the fortune, then symlinked them into /etc/systemd/system/
|
||||||
|
if i want to restart them i can do `systemctl restart cygnus`, and perhaps if i want to reload the config file i do `systemctl daemon-reload`? oh also remember `systemctl list-timers`
|
||||||
|
|
||||||
|
minor note but in the scripts to be run by the system, make sure that things don't depend on environment variables and such unless you really want it. for example use the explicit full path to a program instead of just `fortune` use `/usr/games/fortune` because the environment configures where to look for executables.
|
||||||
|
|
||||||
|
installed yt-dl (through apt) and then yt-dlp because yt-dl didn't work https://github.com/yt-dlp/yt-dlp#installation
|
23
index.html
Normal file
23
index.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Welcome to cygnus!</title>
|
||||||
|
<style>
|
||||||
|
html { color-scheme: light dark; }
|
||||||
|
body { width: 35em; margin: 0 auto;
|
||||||
|
font-family: Tahoma, Verdana, Arial, sans-serif; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Welcome to cygnus!</h1>
|
||||||
|
<p>You've reached the cygnus homepage! Cygnus is pear house's NAS, or network attached storage. Hopefully in the future, this page will be automatically updated with information about cygnus, drive status, backups tatus, and possibly other things like a view of the backyard!</p>
|
||||||
|
|
||||||
|
<p>The system administrator for this computer is Ada "Shoofle" Munroe. Contact her if you have any questions or cool ideas for things cygnus could do!</p>
|
||||||
|
|
||||||
|
<p><em>Thank you for visiting!!!</em></p>
|
||||||
|
|
||||||
|
<p>The following fortune is taken from the unix fortune file and should not be considered legally binding. At some point soon I'll curate them to only have ones that I would be comfortable popping up at random to our house.</p>
|
||||||
|
|
||||||
|
<pre id="fortune-container">fortune goes here</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
19
update_fortune.py
Normal file
19
update_fortune.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import os
|
||||||
|
|
||||||
|
fortune = os.popen("/usr/games/fortune | /usr/games/cowsay").read()
|
||||||
|
|
||||||
|
file_name = "/var/www/html/index.html"
|
||||||
|
soup = None
|
||||||
|
|
||||||
|
print("The emergency fortune system has set the fortune to {}".format(fortune))
|
||||||
|
|
||||||
|
with open(file_name, "r") as the_file:
|
||||||
|
soup = BeautifulSoup(the_file, features="html.parser")
|
||||||
|
|
||||||
|
fortune_holder = soup.find(id="fortune-container")
|
||||||
|
|
||||||
|
fortune_holder.string = fortune
|
||||||
|
|
||||||
|
with open(file_name, "w") as the_file:
|
||||||
|
the_file.write(str(soup))
|
Loading…
Reference in New Issue
Block a user