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

If hostfile does not exist when using -f, try in ~/.hss - Added support for server specific logging via -O #12

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e639fbb
Added support for server specific logging via -O
WillCoates Aug 26, 2020
9bb7d49
If hostfile does not exist when using -f, try in ~/.hss
WillCoates Aug 25, 2020
cec496c
Merge pull request #1 from WillCoates/feature-homehostfile
boussou Aug 26, 2020
c3a37ed
Merge branch 'master' into feature-serverlogs
boussou Aug 26, 2020
313ed5f
Merge pull request #2 from WillCoates/feature-serverlogs
boussou Aug 26, 2020
f6b6653
2 changes:
boussou Aug 26, 2020
f8ed899
Added commands to log file
WillCoates Aug 26, 2020
c254424
When outputting to log files, output is also printed to stdout
WillCoates Aug 26, 2020
1d22695
Merge pull request #3 from WillCoates/master
boussou Aug 26, 2020
61cdfe8
support for sending files to server over SCP
WillCoates Aug 26, 2020
78507f0
Tell remote we're a monochrome terminal
WillCoates Aug 26, 2020
f65eefa
Merge pull request #4 from WillCoates/master
boussou Aug 26, 2020
4701df0
support for recieving files from server via scp
WillCoates Aug 26, 2020
871003d
Always treat destination as a directory for recieving
WillCoates Aug 26, 2020
9f2cbf7
Moved command history file to /.hss/logs/
boussou Aug 26, 2020
7495f37
Merge branch 'master' into feature-scp
WillCoates Aug 26, 2020
1ea5c97
Merge pull request #5 from WillCoates/feature-scp
boussou Aug 26, 2020
19054c2
Fixed log file location function
WillCoates Aug 26, 2020
14637d7
Merge pull request #6 from WillCoates/master
boussou Aug 26, 2020
f4239ee
Fixed log file location function
WillCoates Aug 26, 2020
ff4c248
Fixed SCP for hosts without username
WillCoates Aug 26, 2020
57b393c
Merge pull request #7 from WillCoates/master
boussou Aug 26, 2020
6cc6de3
Added fix to avoid writing colors to log files.
boussou Aug 26, 2020
9f7b815
Added some rough docs
boussou Aug 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Options:
-u user the default user name to use when connecting to the remote server
-c opts specify the common ssh options (i.e. '-p 22 -i identity_file')
-o file write remote command output to a file
-O write remote command output to one log file per server
> file name like ~/.hss/<server>/date_per_day.log
-s transfer files over scp

-i force use a vi-style line editing interface
-v be more verbose
-V show program version
Expand All @@ -40,6 +44,31 @@ For more information, see https://github.com/six-ddc/hss

[![asciicast](https://asciinema.org/a/233954.svg)](https://asciinema.org/a/233954)

### Hosts files

You can pass "-f hostfile" where hostfile is a full path of a plain text file.

The application also uses folder named .hss/ in home as a default for the host files.
if the path given is not found, **the program will look for the file in .hss folder.**
You can then maintain easily hosts groups in a central way.

## scp transfer files

Please look at these commands:

hss -f demo -s /path/to/main.c remote:/tmp
hss -f demo -s remote:/path/to/main.c /tmp

You have to specify which side is the remote machine as SCP can go in either direction.
You specify it always using "remote" keyword (it is not an alias)

you can also type:

hss -f demo -s /path/to/main.c

In this case /tmp is used as the default target.


## How to install it?

* MacOS
Expand Down
42 changes: 41 additions & 1 deletion common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@


#ifndef NOT_USER_COLOR


// RL_PROMPT_START_IGNORE RL_PROMPT_END_IGNORE
#define ANSI_COLOR_RED "\001\x1b[31m\002"
#define ANSI_COLOR_GREEN "\001\x1b[32m\002"
Expand All @@ -32,14 +34,45 @@
#define ANSI_COLOR_CYAN_BOLD "\001\x1b[36;1m\002"

#define ANSI_COLOR_RESET "\001\x1b[0m\001"

/*
// from pull https://github.com/six-ddc/hss/pull/9 by zhanglistar : ANSI_COLOR_RESET cause abnormal display on ubuntu 18.04 #8
// RL_PROMPT_START_IGNORE RL_PROMPT_END_IGNORE
#define ANSI_COLOR_RED "\033[0;31m"
#define ANSI_COLOR_GREEN "\033[0;32m"
#define ANSI_COLOR_YELLOW "\033[0;33m"
#define ANSI_COLOR_BLUE "\033[0;34m"
#define ANSI_COLOR_MAGENTA "\033[0;35m"
#define ANSI_COLOR_CYAN "\033[0;36m"

#define ANSI_COLOR_BOLD "\033[1m"
#define ANSI_COLOR_RED_BOLD "\033[1;31m"
#define ANSI_COLOR_GREEN_BOLD "\033[1;31m"
#define ANSI_COLOR_YELLOW_BOLD "\033[1;31m"
#define ANSI_COLOR_BLUE_BOLD "\033[1;31m"
#define ANSI_COLOR_MAGENTA_BOLD "\033[1;31m"
#define ANSI_COLOR_CYAN_BOLD "\033[1;31m"

#define ANSI_COLOR_RESET "\033[0m"
*/

#else
#define ANSI_COLOR_RED
#define ANSI_COLOR_GREEN
#define ANSI_COLOR_YELLOW
#define ANSI_COLOR_BLUE
#define ANSI_COLOR_MAGENTA
#define ANSI_COLOR_CYAN
#define ANSI_COLOR_RESET

#define ANSI_COLOR_BOLD
#define ANSI_COLOR_RED_BOLD
#define ANSI_COLOR_GREEN_BOLD
#define ANSI_COLOR_YELLOW_BOLD
#define ANSI_COLOR_BLUE_BOLD
#define ANSI_COLOR_MAGENTA_BOLD
#define ANSI_COLOR_CYAN_BOLD

#define ANSI_COLOR_RESET " "
#endif

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
Expand All @@ -49,13 +82,20 @@

extern struct slot *slots;

enum mode {
MODE_SSH,
MODE_SCP,
};

extern struct hss_config {
bool verbose;
char *user;
int common_options_argc;
const char **common_options_argv;
char *output_file;
bool split_server_logs;
int concurrency;
enum mode mode;
} *pconfig;

extern int stdout_isatty;
Expand Down
Loading