# State-scripts documentation: how to use them without Yocto

**URL:** <https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744>\
**Category:** General Discussions\
**Tags:** state-scripts\
**Created:** [June 24, 2019, 3:25pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744 "2019-06-24T15:25:29Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [September 21, 2020, 11:33pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/21 "2020-09-21T23:33:02Z")

</div>

What is the environment variables scriptsDir set to?

---

<div class="post-metadata">

**Author:** ![thesillywhat](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thesillywhat](https://hub.mender.io/u/thesillywhat)\
**Post date:** [September 21, 2020, 11:37pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/22 "2020-09-21T23:37:47Z")

</div>

it was set to the location of host machine from where I generated the artifact

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [September 22, 2020, 1:43pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/23 "2020-09-22T13:43:47Z")

</div>

Does it work in you do “chmod +x” on the file before running the mender-artifact command?

---

<div class="post-metadata">

**Author:** ![thesillywhat](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thesillywhat](https://hub.mender.io/u/thesillywhat)\
**Post date:** [September 22, 2020, 5:55pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/24 "2020-09-22T17:55:41Z")

</div>

I just checked the my state script `ArtifactReboot_Leave_02` does have +x in it permission.  
Just to re-iterate since I get confused between host machine definitions.

The environment variable scriptsDir is set to `/hom/orange/Mender_software/State-Scritps`

But I can try it again

---

<div class="post-metadata">

**Author:** ![thesillywhat](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@thesillywhat](https://hub.mender.io/u/thesillywhat)\
**Post date:** [September 24, 2020, 5:45pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/25 "2020-09-24T17:45:08Z")

</div>

So the issue that I was having, was that I wasn’t able to run the script on its own.  
The main problem stemmed from creating the script on a windows machine and then transferring it over to linux machine.  
I had to run dos2unix and the update was successfully

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [September 28, 2020, 7:18am UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/26 "2020-09-28T07:18:35Z")

</div>

Thx for the update. Glad it worked out. And nice debugging. `dos2unix` was a nice read, and unknown to me.

---

<div class="post-metadata">

**Author:** ![oldev](https://avatars.discourse-cdn.com/v4/letter/o/3be4f8/32.png) [@oldev](https://hub.mender.io/u/oldev)\
**Post date:** [January 19, 2022, 4:11pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/27 "2022-01-19T16:11:39Z")

</div>

Hi,

I’m developing an ArtifactInstall\_Enter script and was wondering about the lifecycle of the script.

Is it intended, that a copy of the script is persisted in /var/lib/mender/scripts/ even after a successful mender -commit and the cleanup of the actual payload?

see here:

```auto
root:tmp# rm /var/lib/mender/scripts/ArtifactInstall_Enter_01_docker-commpose
root:tmp# mender install all-containers-local.mender --log-level debug > install.log 2>&1
root:tmp# mender -commit
INFO[0000] Loaded configuration file: /var/lib/mender/mender.conf
INFO[0000] Loaded configuration file: /etc/mender/mender.conf
INFO[0000] Mender running on partition: /dev/mmcblk2p2
Committing Artifact...
root:tmp# ls /var/lib/mender/scripts/ArtifactInstall_Enter_01_docker-commpose
/var/lib/mender/scripts/ArtifactInstall_Enter_01_docker-compose

```

---

<div class="post-metadata">

**Author:** ![oleorhagen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/oleorhagen/32/297_2.png) [@oleorhagen](https://hub.mender.io/u/oleorhagen)\
**Post date:** [February 8, 2022, 2:29pm UTC](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744/28 "2022-02-08T14:29:04Z")

</div>

Hi @oldev

1. This should probably be a new topic.

2. No, this should not be persisted. Interesting. Can you get me full logs?

[Previous page](https://hub.mender.io/t/state-scripts-documentation-how-to-use-them-without-yocto/744.md?page=1)
