# Custom start script doesnt work

**URL:** <https://discuss.gradle.org/t/custom-start-script-doesnt-work/22506>\
**Category:** Help/Discuss\
**Created:** [April 29, 2017, 12:49pm UTC](https://discuss.gradle.org/t/custom-start-script-doesnt-work/22506 "2017-04-29T12:49:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsupathy](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/nsupathy/32/6138_2.png) [@nsupathy](https://discuss.gradle.org/u/nsupathy)\
**Post date:** [April 29, 2017, 12:49pm UTC](https://discuss.gradle.org/t/custom-start-script-doesnt-work/22506/1 "2017-04-29T12:49:51Z")

</div>

I am running gradle 3.5  
I have to overwrite the start script with a custom start script that adds a few env variables and command line args but the distZip doesnt seem to pick this up. It continues to use the default task and creates the default sh file. The below setting doesnt seem to have an effect at all.

I have been trying this morning. I upgraded gradle 3.3 to 3.5 but that didnt help. I tried putting the startscript on the project dir. Tried a full overwrite of createStartScripts and that didnt help either.

```
task createStartScripts(type: CreateStartScripts) {
    unixStartScriptGenerator.template = resources.text.fromFile("$projectDir/scripts/unixStartScript.txt")
    doLast {
        println "within custom startScripts task"
    }
}

```

Any help to get this sorted much appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![jjustinic](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jjustinic/32/9005_2.png) [@jjustinic](https://discuss.gradle.org/u/jjustinic)\
**Post date:** [April 29, 2017, 5:02pm UTC](https://discuss.gradle.org/t/custom-start-script-doesnt-work/22506/2 "2017-04-29T17:02:12Z")

</div>

The application plugin creates a task of type `CreateStartScripts`, but called `startScripts`. Your example code creates a completely unrelated task of the same type, but would not execute, override, or configure anything used by the `distZip` task. It’s also missing required properties if you did execute it.

If you just want to change the unixStartScript template, you want to _configure_ the generator template of the existing `startScripts` task:

```
startScripts {
    unixStartScriptGenerator.template = resources.text.fromFile("scripts/unixStartScript.txt")
}
```
