Hello world

In this example we'll show a simple Custom Action that creates a file when a button on the interface is pressed. The objective of this example is to be able to quickly set up a Custom action and see it working.

1128

Create a custom script file

Create the following file, also creating any directories as needed. /home/dataplicity/actions/hello_world/hello_world_script.sh.

Edit the file with your favourite editor so that it contains the script below:

#!/bin/bash

touch ~/custom_actions_are_working

echo "[[[ReturnOK]]]"

Save the file and then make sure it has permissions as shown:

chmod 755 /home/dataplicity/actions/hello_world/hello_world_script.sh

Create custom action config file

Create the following file: /home/dataplicity/dataplicity.actions.conf.

Add contents as below:

[section:Hello world]

[action:Click to see CA working]
do:/home/dataplicity/actions/hello_world/hello_world_script.sh

Save the file and exit.

Now when you click on your custom action it will create ~/custom_actions_are_working file in your home directory. This way we know custom actions are working.


What’s Next

From here you can move onto a more involved example