public:remote_screen_capture_of_desktop
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| public:remote_screen_capture_of_desktop [2020/10/02 14:41] – rhudak | public:remote_screen_capture_of_desktop [2024/01/25 03:31] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 27: | Line 27: | ||
|   echo "on ship: desktop captured in ~/ |   echo "on ship: desktop captured in ~/ | ||
|    |    | ||
| + | Make it executable and test: | ||
| + | **remote_screenshot.bash** | ||
| + | |||
| + | And view the figure it made: **~/ | ||
| + | |||
| + | ====Step 2: On Shore==== | ||
| + | And on the landside server, make this script to execute screenshotX.png on the ship, and rsync the file back. Call this one **remote_shipX_screenshot.bash** | ||
| + | |||
| + | ## begin script to get the screenshot back to the landserver ## | ||
| + | #!/bin/bash | ||
| + | ## works best if there is an ssh key on the remote machine | ||
| + | # - make the remote command for screenshot | ||
| + | # - this example requires a port to log in | ||
| + |    | ||
| + |   ssh  -p ##### shipuser@shipserver / | ||
| + |    | ||
| + | ## bring it back, put it in /tmp | ||
| + |   echo " | ||
| + |   rsync -Pv -e 'ssh -p 56565' shipuser@shipserver: | ||
| + |    | ||
| + | ## move it to the location of choice | ||
| + |   mv / | ||
| + |    | ||
| + | Test it by running | ||
| + | |||
| + | **/ | ||
| + | |||
| + | and view the png | ||
| + | |||
| + | ====Step 3: Wrapping with an HTML==== | ||
| + | |||
| + | Now if you are on the landserver you can look at the png file. If you want the png served up on a web location, you can look at it directly. If you want an html to wrap it, so it refreshes every so often, | ||
| + | put this in the same location as shipuser_screenshotX.png: | ||
| + | |||
| + | **shipuser_screenshotX.html** | ||
| + | |||
| + | ##begin html file to display shipuser_screenshtX.png ## | ||
| + |   < | ||
| + |   < | ||
| + |   <meta http-equiv=" | ||
| + |   < | ||
| + |   < | ||
| + |   <img src=" | ||
| + | <br> | ||
| + | <br> | ||
| + | <br> | ||
| + |   </ | ||
| + |    | ||
| + | Then you can browse to this page and it will refresh every 5 min: http:// | ||
| + | |||
| + | |||
| + | ====Step 4: Creating a cronjob==== | ||
| + | |||
| + | Make the <color # | ||
| + | hourly at 10 min past the hour. | ||
| + | |||
| + | **NOTE:** crontab does not have a good environment so if you need to set your PATH, do so in a bash_env file and source that before running the command. That's how I did it.  Or be very explicit about setting your PATH first.This is all **one line**:  | ||
| + | |||
| + |   10 */1 * * * (date +\%F\ \%T; cd / | ||
| + |   / | ||
| + |    | ||
| + | **Another note:** I also outputted the stdout to a log file. | ||
| + | |||
| + | ====Step 5: Running from your laptop==== | ||
| + | |||
| + |   ssh landuser@landserver / | ||
| + |    | ||
| + | or make an alias: | ||
| + | |||
| + |   alias get_shipX_screenshot=' | ||
| + |   "view this file"; echo ""; | ||
| + |    | ||
| + |    | ||
| + | ***Special thank you to Jules Hummon for providing steps/codes above.** | ||
public/remote_screen_capture_of_desktop.1601649697.txt.gz · Last modified:  (external edit)
                
                