When I am starting the service using NSIS it is showing the message “Failed to Start” but the service it...
My requirement is I need to create a service and once created it should show in "Running" status.
For this,I am creating the service and subsequently starting the service like as shown below using the NSIS script:
When I run the below installer script, getting the message box showing "Failed to Start". But If I see the service it is showing as "Running"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
Is my If and Else statements are wrong in the above Start Service script?
Or Is it due to "Pop $0" that we are doing for multiple times (Install Service and Start Service)?
Can I Remove the Service in "Uninstall" Section?
Can I use " RMDir /r /REBOOTOK $INSTDIR" command in the "Uninstall" Section?
Below is my complete code:
;--------------------------------
; The stuff to install
Section "ServiceTestNew (required)"
SectionIn RO
; Set output path to the installation directory. Here is the path C:Program FilesServiceTestNew
SetOutPath $INSTDIR
File E:CodePCPEmainservReleasemainserv.exe
File E:prakashTestmainservdrvutil.dll
File E:prakashTestmainservUpsControl.dll
File E:prakashTestmainservUpsDevice.dll
File E:prakashTestmainservrdp.dll
File E:prakashTestmainservpdcdll.dll
; Write the installation path into the registry
WriteRegStr HKLM SOFTWAREServiceTestNew "Install_Dir" "$INSTDIR"
WriteRegStr HKLM SOFTWAREServiceTestNewDialog "AppDataCollectionDlg" "0"
WriteRegStr HKLM SOFTWAREServiceTestNewService "Image" "mainserv.exe"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "DisplayName" "ServiceTestNew"
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "UninstallString" '"$INSTDIRuninstall.exe"'
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoModify" 1
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoRepair" 1
WriteUninstaller "uninstall.exe"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
;CreateDirectory "$INSTDIRServiceTestNew"
CreateShortcut "$INSTDIRServiceTestNewUninstall.lnk" "$INSTDIRuninstall.exe" "" "$INSTDIRuninstall.exe" 0
CreateShortcut "$INSTDIRServiceTestNewServiceTestNew (MakeNSISW).lnk" "$INSTDIRServiceTestNew.nsi" "" "$INSTDIRServiceTestNew.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew"
DeleteRegKey HKLM SOFTWAREServiceTestNew
; Remove files and uninstaller
Delete $INSTDIRServiceTestNew.nsi
Delete $INSTDIRuninstall.exe
; Remove shortcuts, if any
Delete "$INSTDIRServiceTestNew*.*"
; Remove directories used
RMDir "$INSTDIRServiceTestNew"
RMDir "$INSTDIR"
; To Uninstall the Service
SimpleSC::ExistsService "mainserv62"
; Stop the service using NSIS Simple Service Plugin
SimpleSC::RemoveService "mainserv62"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Unable to Remove the service, error $0"
Abort
${Else}
MessageBox MB_OK "Service removed successfully"
${EndIf}
RMDir /r /REBOOTOK $INSTDIR
SectionEnd
nsis
add a comment |
My requirement is I need to create a service and once created it should show in "Running" status.
For this,I am creating the service and subsequently starting the service like as shown below using the NSIS script:
When I run the below installer script, getting the message box showing "Failed to Start". But If I see the service it is showing as "Running"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
Is my If and Else statements are wrong in the above Start Service script?
Or Is it due to "Pop $0" that we are doing for multiple times (Install Service and Start Service)?
Can I Remove the Service in "Uninstall" Section?
Can I use " RMDir /r /REBOOTOK $INSTDIR" command in the "Uninstall" Section?
Below is my complete code:
;--------------------------------
; The stuff to install
Section "ServiceTestNew (required)"
SectionIn RO
; Set output path to the installation directory. Here is the path C:Program FilesServiceTestNew
SetOutPath $INSTDIR
File E:CodePCPEmainservReleasemainserv.exe
File E:prakashTestmainservdrvutil.dll
File E:prakashTestmainservUpsControl.dll
File E:prakashTestmainservUpsDevice.dll
File E:prakashTestmainservrdp.dll
File E:prakashTestmainservpdcdll.dll
; Write the installation path into the registry
WriteRegStr HKLM SOFTWAREServiceTestNew "Install_Dir" "$INSTDIR"
WriteRegStr HKLM SOFTWAREServiceTestNewDialog "AppDataCollectionDlg" "0"
WriteRegStr HKLM SOFTWAREServiceTestNewService "Image" "mainserv.exe"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "DisplayName" "ServiceTestNew"
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "UninstallString" '"$INSTDIRuninstall.exe"'
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoModify" 1
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoRepair" 1
WriteUninstaller "uninstall.exe"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
;CreateDirectory "$INSTDIRServiceTestNew"
CreateShortcut "$INSTDIRServiceTestNewUninstall.lnk" "$INSTDIRuninstall.exe" "" "$INSTDIRuninstall.exe" 0
CreateShortcut "$INSTDIRServiceTestNewServiceTestNew (MakeNSISW).lnk" "$INSTDIRServiceTestNew.nsi" "" "$INSTDIRServiceTestNew.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew"
DeleteRegKey HKLM SOFTWAREServiceTestNew
; Remove files and uninstaller
Delete $INSTDIRServiceTestNew.nsi
Delete $INSTDIRuninstall.exe
; Remove shortcuts, if any
Delete "$INSTDIRServiceTestNew*.*"
; Remove directories used
RMDir "$INSTDIRServiceTestNew"
RMDir "$INSTDIR"
; To Uninstall the Service
SimpleSC::ExistsService "mainserv62"
; Stop the service using NSIS Simple Service Plugin
SimpleSC::RemoveService "mainserv62"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Unable to Remove the service, error $0"
Abort
${Else}
MessageBox MB_OK "Service removed successfully"
${EndIf}
RMDir /r /REBOOTOK $INSTDIR
SectionEnd
nsis
add a comment |
My requirement is I need to create a service and once created it should show in "Running" status.
For this,I am creating the service and subsequently starting the service like as shown below using the NSIS script:
When I run the below installer script, getting the message box showing "Failed to Start". But If I see the service it is showing as "Running"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
Is my If and Else statements are wrong in the above Start Service script?
Or Is it due to "Pop $0" that we are doing for multiple times (Install Service and Start Service)?
Can I Remove the Service in "Uninstall" Section?
Can I use " RMDir /r /REBOOTOK $INSTDIR" command in the "Uninstall" Section?
Below is my complete code:
;--------------------------------
; The stuff to install
Section "ServiceTestNew (required)"
SectionIn RO
; Set output path to the installation directory. Here is the path C:Program FilesServiceTestNew
SetOutPath $INSTDIR
File E:CodePCPEmainservReleasemainserv.exe
File E:prakashTestmainservdrvutil.dll
File E:prakashTestmainservUpsControl.dll
File E:prakashTestmainservUpsDevice.dll
File E:prakashTestmainservrdp.dll
File E:prakashTestmainservpdcdll.dll
; Write the installation path into the registry
WriteRegStr HKLM SOFTWAREServiceTestNew "Install_Dir" "$INSTDIR"
WriteRegStr HKLM SOFTWAREServiceTestNewDialog "AppDataCollectionDlg" "0"
WriteRegStr HKLM SOFTWAREServiceTestNewService "Image" "mainserv.exe"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "DisplayName" "ServiceTestNew"
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "UninstallString" '"$INSTDIRuninstall.exe"'
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoModify" 1
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoRepair" 1
WriteUninstaller "uninstall.exe"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
;CreateDirectory "$INSTDIRServiceTestNew"
CreateShortcut "$INSTDIRServiceTestNewUninstall.lnk" "$INSTDIRuninstall.exe" "" "$INSTDIRuninstall.exe" 0
CreateShortcut "$INSTDIRServiceTestNewServiceTestNew (MakeNSISW).lnk" "$INSTDIRServiceTestNew.nsi" "" "$INSTDIRServiceTestNew.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew"
DeleteRegKey HKLM SOFTWAREServiceTestNew
; Remove files and uninstaller
Delete $INSTDIRServiceTestNew.nsi
Delete $INSTDIRuninstall.exe
; Remove shortcuts, if any
Delete "$INSTDIRServiceTestNew*.*"
; Remove directories used
RMDir "$INSTDIRServiceTestNew"
RMDir "$INSTDIR"
; To Uninstall the Service
SimpleSC::ExistsService "mainserv62"
; Stop the service using NSIS Simple Service Plugin
SimpleSC::RemoveService "mainserv62"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Unable to Remove the service, error $0"
Abort
${Else}
MessageBox MB_OK "Service removed successfully"
${EndIf}
RMDir /r /REBOOTOK $INSTDIR
SectionEnd
nsis
My requirement is I need to create a service and once created it should show in "Running" status.
For this,I am creating the service and subsequently starting the service like as shown below using the NSIS script:
When I run the below installer script, getting the message box showing "Failed to Start". But If I see the service it is showing as "Running"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
Is my If and Else statements are wrong in the above Start Service script?
Or Is it due to "Pop $0" that we are doing for multiple times (Install Service and Start Service)?
Can I Remove the Service in "Uninstall" Section?
Can I use " RMDir /r /REBOOTOK $INSTDIR" command in the "Uninstall" Section?
Below is my complete code:
;--------------------------------
; The stuff to install
Section "ServiceTestNew (required)"
SectionIn RO
; Set output path to the installation directory. Here is the path C:Program FilesServiceTestNew
SetOutPath $INSTDIR
File E:CodePCPEmainservReleasemainserv.exe
File E:prakashTestmainservdrvutil.dll
File E:prakashTestmainservUpsControl.dll
File E:prakashTestmainservUpsDevice.dll
File E:prakashTestmainservrdp.dll
File E:prakashTestmainservpdcdll.dll
; Write the installation path into the registry
WriteRegStr HKLM SOFTWAREServiceTestNew "Install_Dir" "$INSTDIR"
WriteRegStr HKLM SOFTWAREServiceTestNewDialog "AppDataCollectionDlg" "0"
WriteRegStr HKLM SOFTWAREServiceTestNewService "Image" "mainserv.exe"
; Write the uninstall keys for Windows
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "DisplayName" "ServiceTestNew"
WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "UninstallString" '"$INSTDIRuninstall.exe"'
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoModify" 1
WriteRegDWORD HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew" "NoRepair" 1
WriteUninstaller "uninstall.exe"
;InstallServices:
SimpleSC::InstallService "mainserv62" "UPS Service Test62" "16" "2" "$INSTDIRmainserv.exe" "" "" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "InstallService failed, error $0"
Abort
${Else}
MessageBox MB_OK "mainserv has installed"
${EndIf}
SimpleSC::SetServiceDescription "mainserv62" "PowerChute Personal Edition service for managing battery backup power events."
; Start a service using NSIS Simple Service Plugin
SimpleSC::StartService "mainserv62" ""
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Failed to Start, error $0"
Abort
${Else}
MessageBox MB_OK "Service Started"
${EndIf}
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
;CreateDirectory "$INSTDIRServiceTestNew"
CreateShortcut "$INSTDIRServiceTestNewUninstall.lnk" "$INSTDIRuninstall.exe" "" "$INSTDIRuninstall.exe" 0
CreateShortcut "$INSTDIRServiceTestNewServiceTestNew (MakeNSISW).lnk" "$INSTDIRServiceTestNew.nsi" "" "$INSTDIRServiceTestNew.nsi" 0
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallServiceTestNew"
DeleteRegKey HKLM SOFTWAREServiceTestNew
; Remove files and uninstaller
Delete $INSTDIRServiceTestNew.nsi
Delete $INSTDIRuninstall.exe
; Remove shortcuts, if any
Delete "$INSTDIRServiceTestNew*.*"
; Remove directories used
RMDir "$INSTDIRServiceTestNew"
RMDir "$INSTDIR"
; To Uninstall the Service
SimpleSC::ExistsService "mainserv62"
; Stop the service using NSIS Simple Service Plugin
SimpleSC::RemoveService "mainserv62"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
${If} $0 <> 0
MessageBox MB_ICONSTOP "Unable to Remove the service, error $0"
Abort
${Else}
MessageBox MB_OK "Service removed successfully"
${EndIf}
RMDir /r /REBOOTOK $INSTDIR
SectionEnd
nsis
nsis
asked Nov 14 '18 at 9:15
prakashprakash
848
848
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
SetServiceDescription
is missing a Pop
after. More important, StartService
is missing the third (timeout) parameter.
You might need to stop the service before you can remove it.
To make sure you have the correct number of Pops you can do this:
Section
Push "Hello popping World"
; all other code in the section
Pop $0
MessageBox Mb_Ok $0 ; This should display your message
SectionEnd
Hi @Anders, I am giving the timeout for the StartService and StopService like as shown below: SimpleSC::StartService "mainserv62" "" "30", SimpleSC::StopService "mainserv62" "1" "30". Is it the correct way to give the timeout value in both Start and Stop Services? Here i understood that the service waits for 30 seconds to start. If it is not starting in 30 seconds then what will happen? And also Is it mandatory to give the timeout value?
– prakash
Nov 15 '18 at 6:57
The code you posted does not have a timeout parameter. It is not optional, it has to be a number or "".
– Anders
Nov 15 '18 at 11:21
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296617%2fwhen-i-am-starting-the-service-using-nsis-it-is-showing-the-message-failed-to-s%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
SetServiceDescription
is missing a Pop
after. More important, StartService
is missing the third (timeout) parameter.
You might need to stop the service before you can remove it.
To make sure you have the correct number of Pops you can do this:
Section
Push "Hello popping World"
; all other code in the section
Pop $0
MessageBox Mb_Ok $0 ; This should display your message
SectionEnd
Hi @Anders, I am giving the timeout for the StartService and StopService like as shown below: SimpleSC::StartService "mainserv62" "" "30", SimpleSC::StopService "mainserv62" "1" "30". Is it the correct way to give the timeout value in both Start and Stop Services? Here i understood that the service waits for 30 seconds to start. If it is not starting in 30 seconds then what will happen? And also Is it mandatory to give the timeout value?
– prakash
Nov 15 '18 at 6:57
The code you posted does not have a timeout parameter. It is not optional, it has to be a number or "".
– Anders
Nov 15 '18 at 11:21
add a comment |
SetServiceDescription
is missing a Pop
after. More important, StartService
is missing the third (timeout) parameter.
You might need to stop the service before you can remove it.
To make sure you have the correct number of Pops you can do this:
Section
Push "Hello popping World"
; all other code in the section
Pop $0
MessageBox Mb_Ok $0 ; This should display your message
SectionEnd
Hi @Anders, I am giving the timeout for the StartService and StopService like as shown below: SimpleSC::StartService "mainserv62" "" "30", SimpleSC::StopService "mainserv62" "1" "30". Is it the correct way to give the timeout value in both Start and Stop Services? Here i understood that the service waits for 30 seconds to start. If it is not starting in 30 seconds then what will happen? And also Is it mandatory to give the timeout value?
– prakash
Nov 15 '18 at 6:57
The code you posted does not have a timeout parameter. It is not optional, it has to be a number or "".
– Anders
Nov 15 '18 at 11:21
add a comment |
SetServiceDescription
is missing a Pop
after. More important, StartService
is missing the third (timeout) parameter.
You might need to stop the service before you can remove it.
To make sure you have the correct number of Pops you can do this:
Section
Push "Hello popping World"
; all other code in the section
Pop $0
MessageBox Mb_Ok $0 ; This should display your message
SectionEnd
SetServiceDescription
is missing a Pop
after. More important, StartService
is missing the third (timeout) parameter.
You might need to stop the service before you can remove it.
To make sure you have the correct number of Pops you can do this:
Section
Push "Hello popping World"
; all other code in the section
Pop $0
MessageBox Mb_Ok $0 ; This should display your message
SectionEnd
answered Nov 14 '18 at 16:46
AndersAnders
69.9k1075128
69.9k1075128
Hi @Anders, I am giving the timeout for the StartService and StopService like as shown below: SimpleSC::StartService "mainserv62" "" "30", SimpleSC::StopService "mainserv62" "1" "30". Is it the correct way to give the timeout value in both Start and Stop Services? Here i understood that the service waits for 30 seconds to start. If it is not starting in 30 seconds then what will happen? And also Is it mandatory to give the timeout value?
– prakash
Nov 15 '18 at 6:57
The code you posted does not have a timeout parameter. It is not optional, it has to be a number or "".
– Anders
Nov 15 '18 at 11:21
add a comment |
Hi @Anders, I am giving the timeout for the StartService and StopService like as shown below: SimpleSC::StartService "mainserv62" "" "30", SimpleSC::StopService "mainserv62" "1" "30". Is it the correct way to give the timeout value in both Start and Stop Services? Here i understood that the service waits for 30 seconds to start. If it is not starting in 30 seconds then what will happen? And also Is it mandatory to give the timeout value?
– prakash
Nov 15 '18 at 6:57
The code you posted does not have a timeout parameter. It is not optional, it has to be a number or "".
– Anders
Nov 15 '18 at 11:21
Hi @Anders, I am giving the timeout for the StartService and StopService like as shown below: SimpleSC::StartService "mainserv62" "" "30", SimpleSC::StopService "mainserv62" "1" "30". Is it the correct way to give the timeout value in both Start and Stop Services? Here i understood that the service waits for 30 seconds to start. If it is not starting in 30 seconds then what will happen? And also Is it mandatory to give the timeout value?
– prakash
Nov 15 '18 at 6:57
Hi @Anders, I am giving the timeout for the StartService and StopService like as shown below: SimpleSC::StartService "mainserv62" "" "30", SimpleSC::StopService "mainserv62" "1" "30". Is it the correct way to give the timeout value in both Start and Stop Services? Here i understood that the service waits for 30 seconds to start. If it is not starting in 30 seconds then what will happen? And also Is it mandatory to give the timeout value?
– prakash
Nov 15 '18 at 6:57
The code you posted does not have a timeout parameter. It is not optional, it has to be a number or "".
– Anders
Nov 15 '18 at 11:21
The code you posted does not have a timeout parameter. It is not optional, it has to be a number or "".
– Anders
Nov 15 '18 at 11:21
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53296617%2fwhen-i-am-starting-the-service-using-nsis-it-is-showing-the-message-failed-to-s%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown