Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts for starting POCS automatically - WIP #475

Merged
merged 2 commits into from
Feb 13, 2018

Conversation

jamessynge
Copy link
Contributor

@jamessynge jamessynge commented Feb 12, 2018

These scripts are designed for running:

  • ZeroMQ message forwarders
  • PAWS Web Server
  • PEAS Shell
  • POCS Shell

They are each run in a separate terminal within
tmux, a terminal multiplexer.

These were originally developed for PAN006, and this PR
is for making them more generally applicable.

This is a WIP because I've not yet installed them on
PAN006 and tested them.

These scripts are designed for running:

* ZeroMQ message forwarders
* PAWS Web Server
* PEAS Shell
* POCS Shell

They are each run in a separate terminal within
tmux, a terminal multiplexer.

These were originally developed for PAN008, and this PR
is for making them more generally applicable.

This is a WIP because I've not yet installed them on
PAN008 and tested them.
@jamessynge jamessynge requested a review from wtgee February 12, 2018 02:49
@codecov
Copy link

codecov bot commented Feb 12, 2018

Codecov Report

Merging #475 into develop will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #475      +/-   ##
===========================================
+ Coverage     67.9%   67.92%   +0.01%     
===========================================
  Files           63       63              
  Lines         5449     5449              
  Branches       751      751              
===========================================
+ Hits          3700     3701       +1     
- Misses        1543     1544       +1     
+ Partials       206      204       -2
Impacted Files Coverage Δ
pocs/serial_handlers/protocol_arduinosimulator.py 75.19% <0%> (+0.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 230775a...26ddf6a. Read the comment docs.

Copy link
Member

@wtgee wtgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this will be a good addition. Only thing I would recommend is to open a new window that tails the log file for pocs_shell.

Let me know how testing goes. I'll try it out on PAN001 and PAN001 as soon as I can.

of doing this varies on different versions of Unix/Linux.

Next, we need to arrange for `su_panoptes.sh` to be executed when
the operating system launches. First copy it to /etc:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we symlink this in case it changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a security hole, as it allows the file to be changed without entering the password. For that reason, I prefer to copy it. The files that run as $PANUSER are not copied.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, got it.

@@ -0,0 +1,11 @@
#!/bin/sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not the same as scripts/install/default-env-vars.sh (which has your -z additions)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I'm an idiot? I should have suggested that you document the file as intended to be modified to suit local conditions and then copied into /etc/profile.d/.

As it is, default-env-vars.sh is well suited to running from $HOME/.profile at a point AFTER the user has provided any non-standard values.

sleep 10s
tmux send-keys -t "${WINDOW}" "last_reading environment" C-m
sleep 10s
tmux send-keys -t "${WINDOW}" "last_reading weather" C-m
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the first weather reading usually pulls across Undefined for all the values which I suppose could cause alarm when shown here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How often do we get readings? 30 seconds? A minute? As it stands, it runs about 40 seconds after starting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first reading takes longer and comes back with the undefined values. I find it's usually about 2 minutes before any valid weather reading. Could just leave as is and we can watch it to see if it looks okay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will leave as is.

log file, one from peas_shell, the other from pocs_shell.

tmux send-keys -t "${WINDOW}" "date" C-m
tmux send-keys -t "${WINDOW}" "cd \"${PANLOG}\"" C-m
tmux send-keys -t "${WINDOW}" "less --follow-name \"${LOGFILE}\"" C-m
Copy link
Member

@wtgee wtgee Feb 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I'll probably later submit a patch to this to add grc in front of the less (with appropriate checks if it exists) as I think its nice to have colorized log files. However that requires having a proper grc config file since we don't show standard log messages.

@wtgee
Copy link
Member

wtgee commented Feb 13, 2018

One thing I like about byobu is the default status bar is much more helpful and user friendly. Will this display a status bar with names of windows?

@wtgee
Copy link
Member

wtgee commented Feb 13, 2018

Linking #97.

@jamessynge
Copy link
Contributor Author

Yes, this will show the names of the windows, along with their numbers. I use ^B# (where # is the number of the window) to switch to a window.

@jamessynge jamessynge merged commit 7801138 into panoptes:develop Feb 13, 2018
@jamessynge
Copy link
Contributor Author

Submitting now, even as a WIP, so that it is easy to install on PAN006 for testing.

@jamessynge jamessynge deleted the startup-scripts branch February 14, 2018 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants