npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hubot-script-shellcmd

v1.0.1

Published

Easily list/Execute (bash) shellcommands from a specified folder

Downloads

27

Readme

hubot-script-shellcmd

Easily list/Execute shellcommands from a specified folder, and logs to rsyslog whenever possible.

Commands:

  • Hubot shellcmd - list (bash)shell commands
  • Hubot shellcmd - performs bashshell command

Example

# install
cd <yourhubotdir>
npm install hubot-script-shellcmd

# optional: separate your shellcmds from the npm module
cp -R node_modules/hubot-script-shellcmd/bash .

# run bot
(add 'hubot-script-shellcmd' to external-scripts.json if needed)
node_modules/.bin/hubot

In hubot:

you> hubot shellcmd

hubot> Available commands:
hubot>   helloworld

you> hubot shellcmd helloworld 
hubot> helloworld

Why

Sometimes its easier to trigger bashscripts or do things in bash (git deployment, server mintenance thingies, remote stuff e.g.)

Configuration:

Just drop / paste your bash-scripts into hubot_dir/node_modules/hubot-script-shellcmd/src/bash/handlers/ Done.

In case you separated your bashscripts from the npm module (see Example Section) the directory is bash/handlers in hubot's working directory

Optional: rename the 'shellcmd' directive

Some people would prefer typing foo helloworld instead of shellcmd helloworld. In that case please introduce this environmentvariable:

HUBOT_SHELLCMD_KEYWORD='foo'

(for more env-var usage see the next section)

For example:

$ HUBOT_SHELLCMD_KEYWORD='foo' .bin/hubot 
hubot> hubot foo
Available commands:
  helloworld

Optional: specify different paths

The plugin uses a main bash-script as entry point for the your bash-scripts in handlers/* for security reasons. By default it will point to bash/handler, for most people this will be fine. Some people, who want to bypass this behavious can specify their own startup-script by setting an (startup) env-var:

HUBOT_SHELLCMD="/foo/bar/myhandler" 

in short, you can run hubot like this on the commandline:

$ HUBOT_SHELLCMD="/foo/bar/myhandler" node <hubotfile>

or just put this somewhere in your code:

process.env.HUBOT_SHELLCMD="/foo/bar/myhandler";

or just put this in your .bashrc or shellscript before launching hubot

export HUBOT_SHELLCMD="/foo/bar/myhandler" 

The default handler works fine, but you could define one like this:

myhandler:

allowed="dofoo bar reset"
for cmd in allowed; do 
  [[ "$1" == "$cmd" ]] && "$@" # execute if allowed
done