Restart NAS when modify field in NAV

johanna
Member Posts: 369
Dear All,
Could I add C/AL code to restart NAS service automatically when user modify field in NAV?
How to get NAS status (start/stop) with C/AL Code?
Please help..
Thank you..
Could I add C/AL code to restart NAS service automatically when user modify field in NAV?
How to get NAS status (start/stop) with C/AL Code?
Please help..
Thank you..
Best regards,
Johanna
Johanna
0
Answers
-
Hi Johanna
Try to solve this by organisation. This means changing objecs should not take place in production db, deploy by fob and restart nas after that. Person in charge of deploying should work with checklist. This is not exactly the answer to your question, but works in a lot of projects.
Hope this helps
Thomas0 -
This is a great question!
I have 3 NAS's on three different servers. I would love to be able to stop/restart them from one place- one click.
Now I have to go to the 3 different servers and do each seperately.
How can we do this from within Nav?
Thanks0 -
Commands to start and stop the nas arenet start TheNasName
net stop TheNasName
So you can try by opening the command.exe using shell commands and execute above commands..0 -
Good answer, but my question is still why somebody want to do this :?0
-
ta5 wrote:Good answer, but my question is still why somebody want to do this :?
Instead of loggin into the server and doing net stop/start because he changed the singleinstance codeunit.0 -
The situation:
I am on my Dev machine
I am in NAV connected to the live DB
I import a fob to the Live DB
I want to restart my NAS's (which are on 3 seperate physical servers)
I have to individually connect to the first server
Open the application services
stop and start the NAS
disconnect from that server
connect the next server and repeat
I would like to press a button in Nav or on my desktop and have the process find each server
and stop and start the NAS
Mohana
Thank you for the commands (I presume they are run when on the specific server)
Can I run some variation remotely
How could I tell your commands what server each NAS is on.
Thanks0 -
I think this is what you actually are looking for:
sc \\computername stop NAS-SQL-ServiceName
Mix this with the C/AL SHELL function, and you control your services from Navision.
For me, I use a batch file from my desktop.
My NAV client is on a random citrix server, SQL and NAS both on their own dedicated machine (all VM'd). Your AD account requires the necessary permissions to stop and start services, tough.
When I want to test, I double-click the batch file om my desktop, resulting in:
sc \\NAS-SERVER stop NAS-SQL_DevDatabase
sc \\NAS-SERVER start NAS-SQL_DevDatabase
And yeah, I've thought about ways to ensure the production NAS auto-restarts after it gets disconnected from the database after importing fobs, but this will require some kind of second 'guardian' service or scheduled task. Haven't got a reliable system worked out.0 -
Thanks for the code.
I will try to put this in a Nav function with a call to SHELL or something and report back0 -
SPost29 wrote:Thanks for the code.
I will try to put this in a Nav function with a call to SHELL or something and report back
I've not used it but there's an Automation component that shows up called "nascontrol 1.0 Type Library" with some interesting properties and functions. Maybe you could build something from that?There are no bugs - only undocumented features.0 -
Dear all,
I have found the solution of this issue.
I add new variable Automation 'AutoWindowsScript': 'Windows Script Host Object Model'.WshShell
then add code in OnModify Table :
//STOP SERVICE NAS - START
CREATE(AutoWindowsScript);
AutoWindowsScript.Exec('NET STOP "Navision Application Server NAS"');
CLEAR(AutoWindowsScript);
//STOP SERVICE NAS - FINISH
//DELAY PROCESS - START
COMMIT; // Commit the changes to the database.
SLEEP(5000); // Release locks for a specified duration.
SELECTLATESTVERSION; // Retrieve the most current database version before the process is run.
//DELAY PROCESS - FINISH
//START SERVICE NAS - START
CREATE(AutoWindowsScript);
AutoWindowsScript.Exec('NET START "Navision Application Server NAS"');
CLEAR(AutoWindowsScript);
//START SERVICE NAS - FINISH
Thanks allBest regards,
Johanna0 -
It's also possible to connect to another server via Application Server Manager SnapIn. That means you don't have to switch / logon to every single server. So, I see no issues."Money is likewise the greatest chance and the greatest scourge of mankind."0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions