Summary
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
260,
310
]
},
{
"parameters": {
"command": "osascript -e \"tell application \\\"/Applications/Tunnelblick.app\\\"\" -e \"get state of first configuration where name = \\\"XX\\\"\" -e \"end tell\""
},
"name": "Get status of VPN X",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
480,
310
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"Get status of VPN X\"].json[\"stdout\"]}}",
"value2": "CONNECTED"
}
]
}
},
"name": "IF CONNECTED",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
720,
310
]
},
{
"parameters": {
"command": "osascript -e \"tell application \\\"/Applications/Tunnelblick.app\\\"\" -e \"connect \\\"XX\\\"\" -e \"end tell\""
},
"name": "Connect",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
920,
410
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"name": "SplitInBatches",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
1150,
510
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"stdout\"]}}",
"value2": "CONNECTED"
}
]
}
},
"name": "IF CONNECTED1",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1660,
350
]
},
{
"parameters": {
"channel": "coda-jerome",
"text": "VPN Connecté",
"as_user": true,
"attachments": [],
"otherOptions": {}
},
"name": "Slack",
"type": "n8n-nodes-base.slack",
"typeVersion": 1,
"position": [
1800,
290
],
"credentials": {
"slackApi": "Jerome"
}
},
{
"parameters": {
"functionCode": "const waitTimeSeconds = 1;\n\nreturn new Promise((resolve) => {\n setTimeout(() => {\n resolve(items);\n }, waitTimeSeconds * 1000);\n});\n\n"
},
"name": "Wait1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1330,
520
]
},
{
"parameters": {
"command": "osascript -e \"tell application \\\"/Applications/Tunnelblick.app\\\"\" -e \"get state of first configuration where name = \\\"XX\\\"\" -e \"end tell\""
},
"name": "Get status of VPN X1",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
1460,
350
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Get status of VPN X",
"type": "main",
"index": 0
}
]
]
},
"Get status of VPN X": {
"main": [
[
{
"node": "IF CONNECTED",
"type": "main",
"index": 0
}
]
]
},
"IF CONNECTED": {
"main": [
[
{
"node": "Slack",
"type": "main",
"index": 0
}
],
[
{
"node": "Connect",
"type": "main",
"index": 0
}
]
]
},
"Connect": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
]
]
},
"IF CONNECTED1": {
"main": [
[
{
"node": "Slack",
"type": "main",
"index": 0
}
],
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"Wait1": {
"main": [
[
{
"node": "Get status of VPN XX",
"type": "main",
"index": 0
}
]
]
},
"Get status of VPN XX": {
"main": [
[
{
"node": "IF CONNECTED1",
"type": "main",
"index": 0
}
]
]
}
}
}