DEV Community

loading...
Cover image for How to Create and Execute Shell Scripts Automatically with WayScript
WayScript

How to Create and Execute Shell Scripts Automatically with WayScript

derricksherrill profile image Derrick Sherrill ・2 min read

Introduction

Today’s tutorial is an excellent example for those new to script building in WayScript, as we’ll be creating a Shell script from scratch. This process only takes a minute to do and it’s a great way to become familiar with some of the tools WayScript offers. Additionally, if you’d like to use this script as a base to build off of you can simply clone the script using the link at the end of this tutorial. Keep reading to learn more!

Building our Script

First, we’ll need to create a new script. This can be done by clicking the “+ New Script” button in the top right corner.

Tutorial step #1

This brings up the script tree editor. Here we can add different modules, write our own code, and more. One great aspect of WayScript is its ease of use; to add modules or triggers, simply click on the “add” buttons on the tree.

In this tutorial, we’ll automate a simple Shell script. To do this, add a Time Trigger module at the top of the tree.

Tutorial step #2

Within this module we can customize when the program runs. A toolbar generates on the left side, and in here there are multiple options to choose from: when to run the script, what time, and the specific time zone. This creates an easy way to automate any script.

Next, we’ll add the Shell Script module to write our code into. Once this module is added, we can write the script in a couple different ways. One way is to click on the editor button, which brings up a full screen editor. The other option is to simply type the code in the text box inside the toolbar.

Tutorial step #3

In this tutorial, we’ll just write a text file using the Shell script: echo "some data for the file" >> sample.txt Run the script by clicking the play button on the Time Trigger module. This generates a new file of sample.txt that can be found in the file browser.

Tutorial step #1

Finally, to automate the entire script, simply activate the switch on the Time Trigger module.

In 60 seconds, we’ve effectively created a script that runs automatically using WayScript’s intuitive drag-and-drop interface. Hopefully, this example was a great introduction into the world of WayScript. Keep watch for even more tutorials on how to create a wide variety of scripts and get your own superpowers in the process!

Conclusion

Questions about this script or anything else? Join our discord. We're always around to help. If you want to work the full script template, just find it here.

Discussion (1)

Collapse
michaelcurrin profile image
Michael

Hi, I would have been nice to have a WayScript homepage link in the first paragraph and a description of it, like running code in the cloud based on a trigger and why this is useful.

Forem Open with the Forem app