Raspberrypints Image |
After setting up my RaspberryPints server, I wanted to share the page with everyone. Not wanting to give away the details of the server or exposing an unhardened device to the Internet, I decided to post an image of the tap list.
The process included the following:
- Taking a screenshot using a Cron job
- Create a DropBox Account
- Uploading screenshot to DropBox using DropBox Uploader
- Exposing the DropBox image as a public image
Take Screen Shots
Scrot (SCReenshOT) is an open source, powerful and flexible, command line utility for taking screen shots of your Desktop, Terminal or a Specific Window manually or automatically by Cron job. Scrot is similar to Linux ‘import‘ command, but uses ‘imlib2‘ library to capture and save images. It supports multiple image formats (JPG, PNG, GIF, etc), which you can specify while taking screen shots by using the tool.
Login as Pi
login using the the pi user perform the following
Install Scrot
sudo apt-get install scrot sudo mkdir /screenshots
Modify the scot command
Modify the scort.sh file to provide a consistent filename. This will allow the use of a single file name in your blog. Using the nano editor type the following:
sudo nano /screenshots/scrot.shNow we will change the following line from being a dynamic filename to a constant filename. The following line is changed from
DISPLAY=:0 scrot 'tecmint-%Y-%m-%d-%H_%M.jpg' -q 20 && mv /screenshots/*.jpg /media/tecmint
to
DISPLAY=:0 scrot 'raspberryPints.jpg' -q 20
Modify file permission
sudo chmod u+x /screenshots/scrot.sh
Create the Cron Job for every 60 minutes
crontab -e
0 * * * * /path/to/home/scrot.sh
Ctrl+X to exit and save
sudo /etc/init.d/cron start
Create a DropBox Account
<!*** goodloe.jason@gmail.com ***>
Head to https://www.dropbox.com/developers/apps to create a new Dropbox App
Generate Access Token
Uploading screenshot to DropBox using DropBox Uploader
http://raspberrypituts.com/dropbox-uploader-in-python/
git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
cd Dropbox-Uploader
chmod +x dropbox_uploader.sh
./dropbox_uploader.shThe first time you run dropbox_uploader, you'll be guided through a wizard in order to configure access to your Dropbox. This configuration will be stored in ~/.dropbox_uploader.
DropBox Upload Cron Job
(using pi@raspberryPINTS)
crontab -e
Add the following two lines to the file and save
Select the image in Dropbox. Click the share button, and the following dialog will appear.
*****************
0 * * * * /screenshots/scrot.sh | logger0 * * * * /Dropbox-Uploader/dropbox_uploader.sh upload /home/pi/raspberrypintsscreen.jpg raspberrypintsscreen.jpg | logger
Exposing the DropBox image as a public image
Share DropBox image |
Select copy link.
The link provided by DropBox is for a page. This needs to be modified to the image. The following is the link from DropBox
modify the www.dropbox to dl.dropboxhttps://www.dropbox.com/s/bucohgzq1adquu2/raspberrypintsscreen.jpg?dl=0
This image can now be shared. My results for this page can be seen at the "On Tap" menu link.https://dl.dropbox.com/s/bucohgzq1adquu2/raspberrypintsscreen.jpg
*****************
Note: Instead of modifying the files in my initial implementation, I renamed the files and used the following:
Note: The additional applications are found in the root folder under
- screenshots/scrotsamename.sh
- 0 * * * * /screenshots/scrotsamename.sh | logger
- 0 * * * * /Dropbox-Uploader/dropbox_uploader.sh upload /home/pi/raspberrypintsscreen.jpg raspberrypintsscreen.jpg | logger
- /Dropbox-Uploader
- /screenshots